I'm currently testing an application but it's throwing a Bad JSON Escape Sequence at me, however I don't see the problem...
I'm probably overlooking something so a fresh pair of eyes might be useful.
messageContents = "{\"command\":\"cue\",\"channel\":1,\"uid\":\"aesd-deaf\",\"type\":\"standard\",\"waitforexecute\":true,\"duration\":0,\"scene\":[{\"name\":\"Scene1\",\"fields\":[{\"Quad1\":\"F:\\TestFolder\\mill.jpg\"}]}]}";
And the error I'm getting is
{"Bad JSON escape sequence: \\T. Path 'scene[0].fields[0].Quad1', line 1, position 150."}
Can anyone spot the mistake? Thanks, Kenneth
Like the error says, the problem happens inside the array for the fields
property:
[{\"Quad1\":\"F:\\TestFolder\\mill.jpg\"}]
Imagine what this looks like, once parsed:
[{"Quad1": "F:\TestFolder\mill.jpg"}]
The JSON parser doesn't recognize the escape sequence \T
, which is not the same as \t
.
To fix is simply double escape all the \
characters. So that section would look like:
\"fields\": [{\"Quad1\":\"F:\\\\TestFolder\\\\mill.jpg\"}]
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