Welcome! Please see the About page for a little more info on how this works.

0 votes
in data.json by

Handling of numeric literals doesn't perform according to the JSON spec.

Example:

(require '[clojure.data.json :as json]) (json/read-str "0123") (json/read-str "{\"num\": 0123}")

Both of these examples parse the number as 123. According to the spec, this should actually be an invalid number and throw an exception. NB this restriction does not seem to apply to a number in the exponent, so a number like 1e0003 should be parsed as 1000.0. We handle this case correctly now.

2 Answers

0 votes
by

Comment made by: alex+import

Fix + Tests. Feedback welcome.

0 votes
by
Reference: https://clojure.atlassian.net/browse/DJSON-22 (reported by alex+import)
...