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

The purpose of "Force JSON output to "{}" instead of "[]" if it contains either no properties or all properties are null" #248

Closed
denisvmedia opened this issue Mar 7, 2014 · 1 comment

Comments

@denisvmedia
Copy link

What is the purpose of "Force JSON output to "{}" instead of "[]" if it contains either no properties or all properties are null." in \JMS\Serializer\JsonSerializationVisitor? I wanted to generate a plain array for my AngularJS service (it can expect either array or object) but it seems to be impossible to generate an array with JMS/Serializer. Therefore, I'm wondering, why is there such a hacky force from json array to object?

Currently, after serializing to json using JMS I then need to deserialize using json_decode($var, true) to obtain an array, and then do json_encode($var) to obtain normal array (not object). But this is a workaround, and not a proper solution.

@goetas
Copy link
Collaborator

goetas commented Apr 21, 2017

This was solved with #435

@goetas goetas closed this as completed Apr 21, 2017
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