Hi.
json-parse cannot handle JSON data with inner double quote chars.
> (setf data [text]{"foo": ["bar", ""baz""]}[/text])
"{"foo": ["bar", "\"baz\""]}"
> (json-parse data)
nil
> (json-error)
("invalid JSON array format" 19)
This problem doesn't occur in previous json module.
> (module "json.lsp")
MAIN
> (json2expr data)
(("foo" ("bar" ""baz"")))
P.S. Is json module no longer available?
Documentation page is alive. but download link is 404.
//http://www.newlisp.org/code/modules/json.lsp.html
Thanks Kosh, now fixed here:
http://www.newlisp.org/downloads/development/inprogress/
newLISP v.10.5.2 64-bit on OSX IPv4/6 UTF-8 libffi, options: newlisp -h
> (setf data [text]{"foo": ["bar", ""baz""]}[/text])
"{"foo": ["bar", "\"baz\""]}"
> (json-parse data)
(("foo" ("bar" ""baz"")))
>
Ps: also restored the source for the old json.lsp
Thanks Lutz.
newLISP v.10.5.2 32-bit on Win32 IPv4/6 UTF-8 libffi, options: newlisp -h
> (json-parse [text]{"a backslash":"\"}[/text])
(("a backslash" "\\"))
This retun value is maybe (("a backslash" "\"))
Regards.
Thanks Kosh, I fixed the escaped back slash:
> (json-parse [text]{"a backslash":"\"}[/text])
(("a backslash" "\"))
... for cases in your other post, where json-parse lets pass certain misformed content, json-parse will stay as it is:
http://www.newlisp.org/downloads/development/inprogress/