I'm using a Java Json library to convert an incoming string into a json one. The lib is json-lib.
The problem is that I can't modify the source so, sometimes I can get some malformed jSon strings especially this kind of key/value strings :
"key":"a quoted "value" "
(this is a simplified example)
As you can see, there are double quotes surrounding the value.
So, is there an API that can replace automatically the inner double quotes with backslash ones?
Thank you.
Well, there can't be. For example, what does the following (malformed example) mean:
"key":"is this a value?","another key":"is this a value too?"
In your condition it might be either:
"key":"is this a value?","another key":"is this a value too?"
^k1 ^v1 ^k2 ^v2
or:
"key\":\"is this a value?\",\"another key":"is this a value too?"
^k1 ^v1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With