[fpc-pascal] JSON parser error due to my data values.
Graeme Geldenhuys
mailinglists at geldenhuys.co.uk
Thu Jan 26 12:04:31 CET 2017
On 2017-01-26 10:56, Karoly Balogh (Charlie/SGR) wrote:
>> Is such escape sequence processing a JSON standard?
>
> Yes. See:
> http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf
Ah, thanks for confirming that. I see now the relevant JSON standards
information regarding a string value is as follows:
==================================
string
""
" chars "
chars
char
char chars
char
any-Unicode-character-
except-"-or-\-or-
control-character
\"
\\
\/
\b
\f
\n
\r
\t
\u four-hex-digits
==================================
> That is probably a bad idea, as it goes against JSON standards. Basically
> the JSON you're trying to feed it is invalid. Fix the JSON, don't try to
> force the parser to work it around.
Thanks, I'll use forward slashes instead and then SetDirSeparators() in
my code after reading in those values.
Looking into the fpjson.pp unit I see the following two functions...
Function StringToJSONString(const S : TJSONStringType) : TJSONStringType;
Function JSONStringToString(const S : TJSONStringType) : TJSONStringType;
Which does all those conversions for you too. Good to know! ;-)
Regards,
Graeme
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
My public PGP key: http://tinyurl.com/graeme-pgp
More information about the fpc-pascal
mailing list