Skip to content

Since Symfony 7.4, JsonStreamer encode arrays as objects #7715

@simondaigre

Description

@simondaigre

API Platform version(s) affected: x.y.z
4.1.14

Description
There is an encofing issue with SF 7.4 when JsonStreamer is enabled:

SF 7.3

[
  {
    "cities": [
      {
        "name": "Paris"
      },
      {
        "name": "La Rochelle"
      }
    ]
  }
]

SF 7.4

[
  {
    "cities": {
      "0": {
        "name": "Paris"
      },
      "1": {
        "name": "La Rochelle"
      }
    }
  }
]

Weirdly, manually using JsonStreamer with SF 7.3 produces the 7.4 result. Only APIP + SF 7.3 is correct.

Also on tests(maybe separate issue ?), the client created with ApiTestCase receive no content with 7.4 and JsonStreamer enabled (works in 7.3).

How to reproduce
https://github.com/simondaigre/apip-repro

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions