d4fde2d4f200 — Chris Cannam 6 years ago
Preserve object element order
1 files changed, 1 insertions(+), 1 deletions(-)

M json.sml
M json.sml +1 -1
@@ 284,7 284,7 @@ structure Json :> JSON = struct
                 case parsePair tokens of
                     ERROR e => ERROR e
                   | OK (pair, T.COMMA :: xs) => parseObject' (pair :: acc) xs
-                  | OK (pair, T.CURLY_R :: xs) => OK (OBJECT (pair :: acc), xs)
+                  | OK (pair, T.CURLY_R :: xs) => OK (OBJECT (rev (pair :: acc)), xs)
                   | OK (_, _) => ERROR "Expected , or } after object element"
         in
             parseObject' [] tokens