JSON-lib escaping / preserving strings JSON-lib escaping / preserving strings json json

JSON-lib escaping / preserving strings


If I understand question correctly, I think json-lib is unique in its assumption of a String being passed needing to be parsed. Other libs typically treat it as String to include (with escaping of double-quotes and backslashes as necessary), i.e. work as you would expect.

So you may want to consider other libraries: I would recommend Jackson, Gson also works.


json-simple offers a JSONObject.escape() method.