[serialization] Implementing a JSON archive

Hi, for a project I'm working on, I need to be able to send JSON-encoded objects on a network connection. I though that extending the xml_[io]archive classes could do the trick, given that JSON, just like xml, is based on representing an object by a collection of NVPs (name-value pairs). However, I was unable to find an explication on _how_ to extend that class, and I lost myself very quickly when I tried to follow the code in the source. Thus I'm wondering... First, should I actually modify xml_[io]archive or should I extend text_[io]archive by adding serialization of NVPs? If, as I think, the right way is to extend text_[io]archive, and more so if I should actually extend/modify xml_[io]archive, does anyone have suggestion on how to do that? Even better, does anyone have a JSON serializer I could use in a (*commercial*) project? Thanks a lot for your help -- Leo Cacciari Aliae nationes servitutem pati possunt. Populi Romani est propria libertas.

Leo,
Check out the Boost PropertyTree Library. This has a JSON parser. I did use
this to communicate JSON about 4 or 5 years ago before it was accepted to
Boost and it worked well for my needs.
Regards,
Richard
On 16 September 2011 10:06, Leo Cacciari
Hi, for a project I'm working on, I need to be able to send JSON-encoded objects on a network connection. I though that extending the xml_[io]archive classes could do the trick, given that JSON, just like xml, is based on representing an object by a collection of NVPs (name-value pairs). However, I was unable to find an explication on _how_ to extend that class, and I lost myself very quickly when I tried to follow the code in the source.
Thus I'm wondering...
First, should I actually modify xml_[io]archive or should I extend text_[io]archive by adding serialization of NVPs?
If, as I think, the right way is to extend text_[io]archive, and more so if I should actually extend/modify xml_[io]archive, does anyone have suggestion on how to do that?
Even better, does anyone have a JSON serializer I could use in a (*commercial*) project?
Thanks a lot for your help
-- Leo Cacciari
Aliae nationes servitutem pati possunt. Populi Romani est propria libertas.
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

If you're really, really desparate, you could google "JSON boost serialization" Robert Ramey Leo Cacciari wrote:
Hi, for a project I'm working on, I need to be able to send JSON-encoded objects on a network connection. I though that extending the xml_[io]archive classes could do the trick, given that JSON, just like xml, is based on representing an object by a collection of NVPs (name-value pairs). However, I was unable to find an explication on _how_ to extend that class, and I lost myself very quickly when I tried to follow the code in the source.
Thus I'm wondering...
First, should I actually modify xml_[io]archive or should I extend text_[io]archive by adding serialization of NVPs?
If, as I think, the right way is to extend text_[io]archive, and more so if I should actually extend/modify xml_[io]archive, does anyone have suggestion on how to do that?
Even better, does anyone have a JSON serializer I could use in a (*commercial*) project?
Thanks a lot for your help
participants (3)
-
Leo Cacciari
-
Richard Rowlands
-
Robert Ramey