I am using boost::property_tree to process, edit, then re-output a very large json file (the file comes from a simulator and includes several thousand key-value pairs). Reading in the json, and making the proper modifications works fine, however the boost property_tree's write_json function outputs all values as strings (as described here).
In my case, within my json string, there are 10 or so (repeated) keys that will always have a numeric value (the rest of the key names are strings). So I am wondering if there is a way (likely using boost's regex matching/replacing) to search for a given key, and remove the quotes around its value. e.g.- if I have the string:
... "lots": "of", "key-value": "pairs", "numeric1": "12.3", "numeric2": "45.6", ...
I might do a search for "numeric1", then remove the next two quotes after it. Repeat the same for "numeric2" yielding:
... "lots": "of", "key-value": "pairs", "numeric1": 12.3, "numeric2": 45.6, ...
Note: I might have several hundred "numeric1" keys and several hundred "numeric2" keys that need to be converted to numbers throughout the json string. Thoughts?