You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: