Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Json encode problem : array(0 => 'A', 1 => 'B') => ['A', 'B'] array(1 => 'B', 2 => 'C') => {1: "B", 2: "C" #302

Closed
grifx opened this issue Jun 8, 2013 · 1 comment

Comments

@grifx
Copy link

grifx commented Jun 8, 2013

In my REST If I GET: "events":["Noël", "Pâques", "Foo"] When I PUT : "events":["Noël", "Pâques"] to my REST I have : "events":["Noël", "Pâques"]... PERFECT :)

when i PUT an "events":["Pâques", "Foo"] I get : "events":{"1":"P\u00e2ques","2":"Foo"} . It's due to the json ENcode comportment : array(0 => 'A', 1 => 'B') => ['A', 'B'] array(1 => 'B', 2 => 'C') => {1: "B", 2: "C"}. if there isn't the 0, it changes it to objects. How can I reorganise it before serialization

I would like to know if it's possible to create a serializer handler for an array collection which contains specified object who implements TagInterface.
I know I just have to use an array_values($collection->toArray()). Because when I remove an object from the collection. I delete the continuity of ids. I just don't know where to handle that...

Thanks

Thanks a lot

@schmittjoh
Copy link
Owner

Please use stackoverflow for questions. This is just a bug tracker.

jorns pushed a commit to jorns/JMSSerializerBundle that referenced this issue Aug 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants