# HG changeset patch # User Chris Cannam # Date 1493040594 -3600 # Mon Apr 24 14:29:54 2017 +0100 # Node ID d4fde2d4f2003ad32e3892310a4a4d0039cdb3da # Parent e3b971fb65ce14ef82ac562b25f019b583136b63 Preserve object element order diff --git a/json.sml b/json.sml --- a/json.sml +++ b/json.sml @@ -284,7 +284,7 @@ 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