[DJSON-1] Reflection warnings Created: 28/Jul/11 Updated: 14/Oct/11 Resolved: 14/Oct/11 |
|
| Status: | Closed |
| Project: | data.json |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major |
| Reporter: | Sean Corfield | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The following reflection warnings are reported when using data.json - I was given the impression that "standard" (i.e., new contrib) libraries shouldn't have any: Reflection warning, clojure/data/json.clj:36 - call to equiv can't be resolved. |
| Comments |
| Comment by Stuart Sierra [ 14/Oct/11 1:22 PM ] |
|
Fixed (for Clojure 1.3.0) in release 0.1.2 |
[DJSON-2] Add support for encoding maps and sequences Created: 07/Oct/11 Updated: 07/Mar/12 Resolved: 07/Mar/12 |
|
| Status: | Closed |
| Project: | data.json |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Tal Liron | Assignee: | Unassigned |
| Resolution: | Declined | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Here is some trivial workaround code I've been using: (defn jsonable [o] (cond (map? o) (zipmap (keys o) (map jsonable (vals o))) (seq? o) (map jsonable o))) |
| Comments |
| Comment by Stuart Sierra [ 14/Oct/11 8:38 AM ] |
|
I don't understand. Maps and sequences have always been supported: user=> (json-str {:a 1 :b 2})
"{\"a\":1,\"b\":2}"
user=> (json-str (range 5))
"[0,1,2,3,4]"
|
[DJSON-4] Please make function write-string public Created: 22/Oct/12 Updated: 27/Oct/12 Resolved: 27/Oct/12 |
|
| Status: | Closed |
| Project: | data.json |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Jan Herich | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | enhancement | ||
| Description |
|
Please make function write-string in namespace clojure.data.json public, instead of private as it is now: for example, i'm extending java.sql.Timestamp with JSONWriter protocol and i need to send ISO formatted timestamp value as string: (defn- write-timestamp [Timestamp out] (extend java.sql.Timestamp js/JSONWriter {:-write write-timestamp}) |
| Comments |
| Comment by Stuart Sierra [ 27/Oct/12 1:12 PM ] |
|
Declined. 'write-string' is an implementation detail, not something I will commit to as a public API. Use the :value-fn option of 'write' to handle extension to new types. Or copy the implementation of 'write-string' into your namespace. |
[DJSON-6] Exception message in string reader says it is an array reader problem Created: 14/Dec/12 Updated: 18/Jan/13 Resolved: 18/Jan/13 |
|
| Status: | Closed |
| Project: | data.json |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Trivial |
| Reporter: | Stefan Kamphausen | Assignee: | Unassigned |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
The function read-quoted-string currently uses the same error message as read-array: "JSON error (end-of-file inside array)". Looks like copy and paste error to me. Fix will be trivial IMHO. |
| Comments |
| Comment by Stefan Kamphausen [ 14/Dec/12 5:26 AM ] |
|
Trivial patch which changes the error message. |
| Comment by Stefan Kamphausen [ 14/Dec/12 5:53 AM ] |
|
incremental patch to add tests for detection of EOF in unterminated arrays and strings. This diff is against HEAD~1, i.e. not against master and thus does not contain the fix itself. |
| Comment by Stuart Sierra [ 18/Jan/13 8:57 AM ] |
|
applied, with slight modifications |
[DJSON-3] Error writing strings with characters outside the BMP Created: 16/Dec/11 Updated: 09/Mar/12 Resolved: 07/Mar/12 |
|
| Status: | Resolved |
| Project: | data.json |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Matthew Phillips | Assignee: | Stuart Sierra |
| Resolution: | Completed | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Clojure 1.2 and 1.3, Mac OS X, Java 1.6 |
||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
[This ticket filed as a follow on from pull request 2 at github] One of my users decided to start sending Emoji happy faces over a network protocol encoded using data.json, which caused it to promptly roll over and die. It turned out that write-json-string, while aware of the code point vs. character issue, was still iterating over a character count not a code point count. I have demonstrated the problem in a test, and fixed this: will file a patch when my contributor agreement is in place. |
| Comments |
| Comment by Matthew Phillips [ 05/Jan/12 5:57 PM ] |
|
Patch to fix |
| Comment by Andy Fingerhut [ 13/Jan/12 1:29 AM ] |
|
I'm not an expert on JSON, so feel free to correct me if I am wrong, but it seems from reading RFC 4627 that strings in JSON, if they are encoded with the \uxxxx format for hex digits xxxx, should have their 16-bit UTF-16 code units encoded in that way. There should always be exactly 4 hex digits after the \u. Here are a couple of test cases with the current code, without either of the patches fix_unicode_non_bmp.patch or fix_unicode_non_bmp_2.patch: user=> (in-ns 'clojure.data.json) ;; Incorrect. ;; Also incorrect. Here is the behavior with patch fix_unicode_non_bmp.patch: ; This is correct ;; but this is not. JSON specifies that UTF-16 code units should be Here is the behavior with patch fix_unicode_non_bmp_2.patch: ;; correct ;; also correct. |
| Comment by Andy Fingerhut [ 13/Jan/12 3:18 PM ] |
|
fix_unicode_non_bmp_3.patch is same as fix_unicode_non_bmp_2.patch, except it includes the unit test Matthew Phillips had in his patch, plus another one to test the :escape-unicode true case. |
| Comment by Andy Fingerhut [ 20/Feb/12 4:03 PM ] |
|
Eventually I may even get the hang of this. djson-3-non-bmp-chars-patch.txt contains patch in proper format. |
| Comment by Stuart Sierra [ 07/Mar/12 7:58 AM ] |
|
patch applied. |
| Comment by Matthew Phillips [ 08/Mar/12 6:39 PM ] |
|
Hi Stuart, it looks like you've only applied Andy Fingerhut's last patch. My fix is in the first one: "fix_unicode_non_bmp.patch" |
| Comment by Andy Fingerhut [ 09/Mar/12 11:04 AM ] |
|
Matthew, did you see my comment from Jan 12, 2012? I show a test case there that appears not to work with your patch, unless I am misunderstanding the correct JSON desired behavior. That same test does work with my latest patch, I think. Take a look and see what you think. |
| Comment by Matthew Phillips [ 09/Mar/12 7:41 PM ] |
|
Oh I see - I misunderstood what your were doing there, thinking it only applied to the escape-unicode == true case. And of course the Clojure string is already in UTF-16, so there's no reason to turn it into 32 bit code points and then expand it back to UTF-16 pairs. |
[DJSON-5] data.json 0.2.0 must provide 0.1.x API compatibility layer Created: 24/Oct/12 Updated: 27/Oct/12 Resolved: 27/Oct/12 |
|
| Status: | Resolved |
| Project: | data.json |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Michael Klishin | Assignee: | Stuart Sierra |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
For libraries that rely on data.json the 0.2 release was a major unexpected breakage. For example, for This is some of the craziest code I've seen. While writing it, I realized that several changes clojure.data.json demonstrates very questionable library maintenance practices and the 0.2 release So, bringing back a shim API layer for 0.1.x compatibility is a must. There are many codebases on clojure.data.json 0.1.x and their developers probably are not going to stop doing what they are doing |
| Comments |
| Comment by Michael Klishin [ 24/Oct/12 4:07 PM ] |
|
According to clojuresphere.com, data.json is relied on by 340+ projects: http://www.clojuresphere.com/org.clojure/data.json |
| Comment by Tim McCormack [ 24/Oct/12 4:11 PM ] |
|
Alternative suggestion: Mark the library as "under development/API subject to change" while < v1.0. |
| Comment by Michael Klishin [ 24/Oct/12 4:12 PM ] |
|
@Tim McCormack: if a project is used by over 300 other projects and has been around for about a year, it is just lame to use excuses like that. It is too late, too many people already |
| Comment by Stuart Sierra [ 27/Oct/12 1:09 PM ] |
|
Old APIs restored, documented as "DEPRECATED", in release 0.2.1. |
[DJSON-10] data.json does not AOT Created: 29/Apr/13 Updated: 29/Apr/13 Resolved: 29/Apr/13 |
|
| Status: | Resolved |
| Project: | data.json |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | David Nolen | Assignee: | Unassigned |
| Resolution: | Declined | Votes: | 0 |
| Labels: | None | ||
| Description |
|
When trying to AOT data.json I get the following exception: CompilerException java.lang.ClassNotFoundException: clojure.data.json.JSONWriter, compiling:(clojure/data/json.clj:279:1) I encountered this problem while looking into the possibility of AOTing the ClojureScript compiler to avoid startup time issues. ClojureScript now depends on data.json to help with source maps - so this was the first AOT hurdle I encountered. The exact steps I take to reproduce the bug:
|
| Comments |
| Comment by David Nolen [ 29/Apr/13 12:27 PM ] |
|
Not a bug |
[DJSON-7] Write-str outputs invalid JSON when key/value pairs are removed Created: 08/Jan/13 Updated: 02/Apr/13 Resolved: 02/Apr/13 |
|
| Status: | Resolved |
| Project: | data.json |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Fred Caton | Assignee: | Stuart Sierra |
| Resolution: | Completed | Votes: | 1 |
| Labels: | None | ||
| Environment: |
clojure.data.json 0.2.0 |
||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
When key/value pairs are removed by the function defined for :value-fn, commas are still output and this results in invalid JSON. To remove the errant commas, I've had to wrap write-str in (write-str (read-str ())). Here is a simple example from the REPL: main=> (defn remove-nils [k v] main=> (def test main=> (json/write-str test :value-fn remove-nils) main=> (json/write-str (json/read-str (json/write-str test :value-fn remove-nils))) |
| Comments |
| Comment by Andy Fingerhut [ 22/Jan/13 12:29 AM ] |
|
djson-7-dont-write-unnecessary-commas-v1.txt dated Jan 21 2013 modifies write-object so that it only writes out a comma if :value-fn does not cause the key/value pair to be omitted. |
| Comment by Stuart Sierra [ 02/Apr/13 7:05 PM ] |
|
Patch applied. |
[DJSON-8] write-json is documented to write to arg out, but instead writes to *out* Created: 27/Mar/13 Updated: 02/Apr/13 Resolved: 02/Apr/13 |
|
| Status: | Resolved |
| Project: | data.json |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Andy Fingerhut | Assignee: | Stuart Sierra |
| Resolution: | Completed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
The summary pretty much says it all. |
| Comments |
| Comment by Andy Fingerhut [ 27/Mar/13 6:50 PM ] |
|
Patch djson-8-correct-write-json-patch-v1.txt dated Mar 27 2013 is a simple one-line fix. |
| Comment by Stuart Sierra [ 02/Apr/13 7:06 PM ] |
|
Already fixed in commit d3cce5b200031cf22603c13a9a39e3939651d344 |
[DJSON-11] Commas still don't work properly in all cases for removed values via value-fn Created: 16/May/13 Updated: 17/May/13 |
|
| Status: | Open |
| Project: | data.json |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | John Stoneham | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
DSON-7 fixes the problem with printing JSON with extra commas, but only as long as the last item is actually printable (the test doesn't appear to demonstrate this, but the keys are iterated in hash order, not insertion order). If the last item's no good, we still have a problem. The best way to handle this without trying to precalculate value-fn for the next value (in case it's not needed) is to insert the comma BEFORE we print the current value, but only if it's not the first thing to be printed. |
| Comments |
| Comment by Andy Fingerhut [ 17/May/13 8:33 AM ] |
|
Doh! Patch djson-11-fix-comma-printing-patch-v1.txt dated May 17 2013 should really fix things, including changing the test to exhibit the problem (before this fix). |
[DJSON-9] Always escape U+2028 and U+2029 to be nice to broken JSON parsers Created: 28/Apr/13 Updated: 28/Apr/13 |
|
| Status: | Open |
| Project: | data.json |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Tim McCormack | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
U+2028 and U+2029 should be treated like \n and, viz, escaped even when *escape-unicode* is false. A number of JSON parsers (such as ExtJS's) think they can eval JSON in a JS runtime to decode it. This is not true, since JS does not allow U+2028 and U+2029 unescaped in strings: http://timelessrepo.com/json-isnt-a-javascript-subset While this is broken behavior, it is also quite common, so escaping these characters uniformly may ease some developer pain and surprise. |
| Comments |
| Comment by Tim McCormack [ 28/Apr/13 9:46 PM ] |
|
Attached patch. |