In my program I need to output simle JSON data. I looked at many libraries for JSON in c++, they are too complex for my task. Is there some easier way, how to create JSON-safe string from any c++ string?
string s = "some potentially dangerous string";
cout << "{\"output\":\"" << convert_string(s) << "\"}";
How would function convert_string(string s) look like?
thanks
If your data is in UTF-8, per the string graph on http://json.org/: