JKI-JSON-Serialization
JKI-JSON-Serialization copied to clipboard
seems to only deal with perfect set of data, and only singles set of double quotes
If the data matches a json format, it should still be able to parse right?
I am having an issue where the data I am parsing looks like this when I save it to a file and the jki can't parse it:
{""super"":""fun""}
I suspect you need to escape the inner quotes.
"\"fun\""
Escape it before I input it into the jki json block?
On Thu, Apr 23, 2020, 14:01 Francois Normandin [email protected] wrote:
I suspect you need to escape the second quote.
""fun""
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JKISoftware/JKI-JSON-Serialization/issues/35#issuecomment-618632787, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEYP7NBPT54P2XXLLMBDWLROCNABANCNFSM4MPMQODA .
Hi Walter, I'm sorry, I should have taken more care in answering clearly. Your input string is not a valid JSON string. Some characters need to be escaped because they are interpreted by the serializer/deserializer as delimitation characters.
You can see a list of characters that need to be escaped here.
For example, if your input string is "fun"
, then the flattened JSON output will be "\"fun\""
.
The reverse unflattening operation will return "fun"
with the quotes because the slash characters tell the algorithm to not consider the following character as a delimiter.
Again, consider these two examples:
Hi @wegunterjr, you can check if your JSON string is valid or not by using a tool like https://jsonlint.com/
According to the validator,
-
{""super"":""fun""}
is not a valid JSON string; it will not be accepted by JSON parsers. -
{"\"super\"": "\"fun\""}
is a valid JSON string; it will be accepted by JSON parsers.