Zulu-Inuoe/jzon

Non-square multi-dimensional arrays stringifying incorrectly

Closed this issue · 0 comments

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)