Handling JSON with Boost

Hi all, I'm interested whether there exists a library for working with JSON in Boost that preserves data types? I know about property_tree, but if I read a valid JSON with it and then write it out it results in all fields being strings. This is because property_tree internally does not distinguish different value types. But I need something that can read e.g. {"number":42} get access to it and write it then in the same form. Thanks for answering, regards, Jauhien

I've had great success with the JSON Spirit Boost library:
http://www.codeproject.com/Articles/20027/JSON-Spirit-A-C-JSON-Parser-Genera...
My only complaint is that it may silently fail if it hits something it
doesn't understand.
Adam Baxter
On Mon, Nov 4, 2013 at 3:01 PM, Jauhien Piatlicki
Hi all,
I'm interested whether there exists a library for working with JSON in Boost that preserves data types?
I know about property_tree, but if I read a valid JSON with it and then write it out it results in all fields being strings. This is because property_tree internally does not distinguish different value types. But I need something that can read e.g.
{"number":42}
get access to it and write it then in the same form.
Thanks for answering, regards, Jauhien
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

On 4 November 2013 20:01, Jauhien Piatlicki
Hi all,
I'm interested whether there exists a library for working with JSON in Boost that preserves data types?
I know about property_tree, but if I read a valid JSON with it and then write it out it results in all fields being strings. This is because property_tree internally does not distinguish different value types. But I need something that can read e.g.
{"number":42}
get access to it and write it then in the same form.
You may check https://github.com/cierelabs/json_spirit developed by the Spirit team. Best regards, -- Mateusz Loskot, http://mateusz.loskot.net

Thank you, Mateusz and Adam. It is exactly that I've been looking for. Reagrds, Jauhien 04.11.13 23:08, Mateusz Loskot написав(ла):
On 4 November 2013 20:01, Jauhien Piatlicki
wrote: Hi all,
I'm interested whether there exists a library for working with JSON in Boost that preserves data types?
I know about property_tree, but if I read a valid JSON with it and then write it out it results in all fields being strings. This is because property_tree internally does not distinguish different value types. But I need something that can read e.g.
{"number":42}
get access to it and write it then in the same form.
You may check https://github.com/cierelabs/json_spirit developed by the Spirit team.
Best regards,

I used to use json_spirit, but I recently switched to libjsoncpp. It's not boost, but I like it better. Rgds Richard On Mo, 2013-11-04 at 21:01 +0100, Jauhien Piatlicki wrote:
Hi all,
I'm interested whether there exists a library for working with JSON in Boost that preserves data types?
I know about property_tree, but if I read a valid JSON with it and then write it out it results in all fields being strings. This is because property_tree internally does not distinguish different value types. But I need something that can read e.g.
{"number":42}
get access to it and write it then in the same form.
Thanks for answering, regards, Jauhien
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (4)
-
Adam Baxter
-
Jauhien Piatlicki
-
Mateusz Loskot
-
Richi Lists