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

Using serializer for JSON serialising #223

Closed
CMCDragonkai opened this issue Jan 30, 2014 · 3 comments
Closed

Using serializer for JSON serialising #223

CMCDragonkai opened this issue Jan 30, 2014 · 3 comments

Comments

@CMCDragonkai
Copy link

What would be the advantages of using serializer for JSON serialising vs using the native json_encode?

@stof
Copy link
Contributor

stof commented Jan 30, 2014

try running json_encode on an object: unless it implements JsonSerializable, you will get only public properties.

And when implementing JsonSerializable, you can only have 1 way to serialize an object, while the JMS serializer can have different rules (including some fields only in some cases for instance), and will also avoid redefining the same stuff everywhere (converting DateTime instances for instance).

note that the native json_encode is actually used by the serializer as well to build the JSON itself. However, it transforms the object graph to an array graph first.

@CMCDragonkai
Copy link
Author

Sounds good. It seems that this library doesn't ask for any XML extensions. I guess the serializing to XML does not require extensions? Should it ask for it in case it's faster to use a C extension?

@goetas
Copy link
Collaborator

goetas commented Aug 21, 2016

I guess the serializing to XML does not require extensions?

it uses php dom extension

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

3 participants