Zulu-Inuoe / jzon

A correct and safe(er) JSON RFC 8259 reader/writer with sane defaults.
MIT License
151 stars 14 forks source link

Non-square multi-dimensional arrays stringifying incorrectly #43

Closed kjcjohnson closed 1 year ago

kjcjohnson commented 1 year ago

Looks like non-square multi-dimensional arrays aren't stringifying correctly:

; Square array (2×2) - works correctly
(jzon:stringify #2A((0 1) (2 3)))
=> "[[0,1],[2,3]]"

; Rectangular (2×3) - wrong elements
(jzon:stringify #2A((0 1 2) (3 4 5)))
=> "[[0,1,2],[2,3,4]]"
; Should be "[[0,1,2],[3,4,5]]"

; Rectangular (3×2) - error signaled
(jzon:stringify #2A((0 1) (2 3) (4 5)))

Invalid index 6 for (SIMPLE-ARRAY T (3 2)), should be a non-negative integer below 6.
   [Condition of type SB-INT:INVALID-ARRAY-INDEX-ERROR]
; Should be "[[0,1],[2,3],[4,5]]"

SBCL 2.3.1, using latest jzon from Quicklisp (jzon-20230215-git)