From bhyde at pobox.com Sun Oct 29 23:42:05 2006 From: bhyde at pobox.com (Ben Hyde) Date: Sun, 29 Oct 2006 18:42:05 -0500 Subject: [cl-json-devel] (no subject) Message-ID: <64070B06-4FD6-451B-927C-0011BAEC89EB@pobox.com> Suggestion: (defun json-escaped-char-to-lisp(json-escaped-char) (or (cdr (assoc json-escaped-char *json-lisp-escaped-chars*)) json-escaped-char)) The existing implementation is correct, just not particularly tolerant of what people actually do. In particular it parsing of json from del.icio.us. It can handle: (json:decode-json-from-string "right's of man") but not (json:decode-json-from-string "right\\'s of man") "generous in what you accept", and all that. - ben "... no code should do that unless it should." -- Marc Slemko From henrik at evahjelte.com Tue Oct 31 09:23:50 2006 From: henrik at evahjelte.com (Henrik Hjelte) Date: Tue, 31 Oct 2006 10:23:50 +0100 Subject: [cl-json-devel] (no subject) In-Reply-To: <64070B06-4FD6-451B-927C-0011BAEC89EB@pobox.com> References: <64070B06-4FD6-451B-927C-0011BAEC89EB@pobox.com> Message-ID: <1162286630.23108.123.camel@trinidad> On Sun, 2006-10-29 at 18:42 -0500, Ben Hyde wrote: > Suggestion: > > (defun json-escaped-char-to-lisp(json-escaped-char) > (or > (cdr (assoc json-escaped-char *json-lisp-escaped-chars*)) > json-escaped-char)) > > The existing implementation is correct, just not particularly > tolerant of what people actually do. In particular it parsing of > json from del.icio.us. > > It can handle: > (json:decode-json-from-string "right's of man") > but not > (json:decode-json-from-string "right\\'s of man") > > "generous in what you accept", and all that. > - ben I'd say sometimes it is good to be tolerant and sometimes not, so I have pushed a patch that allows both ways. If you want to allow non-strict json, set *use-strict-json-rules* to nil. If only strict json is allowed, the parser will now signal a json-parse-error. /Henrik From bhyde at pobox.com Tue Oct 31 12:21:53 2006 From: bhyde at pobox.com (Ben Hyde) Date: Tue, 31 Oct 2006 07:21:53 -0500 Subject: [cl-json-devel] (no subject) In-Reply-To: <1162286630.23108.123.camel@trinidad> References: <64070B06-4FD6-451B-927C-0011BAEC89EB@pobox.com> <1162286630.23108.123.camel@trinidad> Message-ID: sweet! thanks! On Oct 31, 2006, at 4:23 AM, Henrik Hjelte wrote: > On Sun, 2006-10-29 at 18:42 -0500, Ben Hyde wrote: >> Suggestion: >> >> (defun json-escaped-char-to-lisp(json-escaped-char) >> (or >> (cdr (assoc json-escaped-char *json-lisp-escaped-chars*)) >> json-escaped-char)) >> >> The existing implementation is correct, just not particularly >> tolerant of what people actually do. In particular it parsing of >> json from del.icio.us. >> >> It can handle: >> (json:decode-json-from-string "right's of man") >> but not >> (json:decode-json-from-string "right\\'s of man") >> >> "generous in what you accept", and all that. >> - ben > > I'd say sometimes it is good to be tolerant and sometimes not, so I > have > pushed a patch that allows both ways. If you want to allow non-strict > json, set *use-strict-json-rules* to nil. If only strict json is > allowed, the parser will now signal a json-parse-error. > > /Henrik