From cde0a14dfdf5e46f73a6526857874028d80ba082 Mon Sep 17 00:00:00 2001 From: John Scancella Date: Tue, 16 Feb 2016 20:17:22 -0500 Subject: [PATCH] make the json object ordered --- JSONObject.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/JSONObject.java b/JSONObject.java index 1ce25401f..01e7d5705 100644 --- a/JSONObject.java +++ b/JSONObject.java @@ -34,7 +34,7 @@ of this software and associated documentation files (the "Software"), to deal import java.math.BigInteger; import java.util.Collection; import java.util.Enumeration; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Iterator; import java.util.Locale; import java.util.Map; @@ -43,7 +43,7 @@ of this software and associated documentation files (the "Software"), to deal import java.util.Set; /** - * A JSONObject is an unordered collection of name/value pairs. Its external + * A JSONObject is an collection of name/value pairs. Its external * form is a string wrapped in curly braces with colons between the names and * values, and commas between the values and names. The internal form is an * object having get and opt methods for accessing @@ -154,7 +154,7 @@ public String toString() { * Construct an empty JSONObject. */ public JSONObject() { - this.map = new HashMap(); + this.map = new LinkedHashMap(); } /** @@ -240,7 +240,7 @@ public JSONObject(JSONTokener x) throws JSONException { * the JSONObject. */ public JSONObject(Map map) { - this.map = new HashMap(); + this.map = new LinkedHashMap(); if (map != null) { for (final Entry e : map.entrySet()) { final Object value = e.getValue();