Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: Parsing numbers that have decimal places

$
0
0
Hi Zack,

We unfortunately do not store the string form of the decimals we parse. If the exact form of the decimal is needed, it would be better (as you've implied) to have it sent as a string.

While it's not a particularly robust solution, you could take the string form of the JSON, do a minor parsing pass to transform all doubles into strings, and then pass that to the JSON parser. In the most informal case, you could look at C++11 regular expressions to do this.

Alternatively, you could try plugging in a 3rd-party JSON parser such as rapidjson (I don't know if RapidJSON specifically has this capability, but I assume one will exist). Casablanca is quite modular, so replacing an individual component should still work quite well.

Sincerely,
roschuma

Viewing all articles
Browse latest Browse all 4845

Trending Articles