Jaŭhien Piatlicki
Jaŭhien Piatlicki

Reputation: 883

Handling JSON with Boost

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. Hence my question.

Upvotes: 1

Views: 331

Answers (1)

kaliatech
kaliatech

Reputation: 17867

JSON Spirit is based on Boost, and can be used for reading/writing json while preserving basic types. It requires transforming to variant type objects for holding the type information.

Upvotes: 1

Related Questions