New JSON encoding method proposal for custom objects
cescus92 at gmail.com
cescus92 at gmail.com
Mon Nov 30 07:35:13 EST 2015
Hello everyone and thank you for your interest!
The Peter's code is very similar to what I think the default JSON encoder should be.
The advantage of the method that I propose is that you should not care anymore about which encoder you're going to use even in case of different class instances. Imagine if you could just do
json.dumps({[1,2,3], Obj(), [DifferentObj()] })
Probably it doesn't worth a PEP but it's a very small change that can be great for making painless REST interfaces as Marco underlined (it was exactly what I was meaning, thanks)!
Denis, the way back is not considered in my proposal. But using the standard json.loads() could be nice enough! :)
> Go to python-ideas for a lengthy discussion ;)
Where can I find it?
Thank you again, I hope now my idea is clearer!
More information about the Python-list
mailing list