Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using LinkedHashMap to preserve property order. #106

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions JSONObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ of this software and associated documentation files (the "Software"), to deal
import java.lang.reflect.Modifier;
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;
Expand Down Expand Up @@ -152,7 +152,7 @@ public String toString() {
* Construct an empty JSONObject.
*/
public JSONObject() {
this.map = new HashMap<String, Object>();
this.map = new LinkedHashMap<String, Object>();
}

/**
Expand Down Expand Up @@ -243,7 +243,7 @@ public JSONObject(JSONTokener x) throws JSONException {
* @throws JSONException
*/
public JSONObject(Map<String, Object> map) {
this.map = new HashMap<String, Object>();
this();
if (map != null) {
Iterator<Entry<String, Object>> i = map.entrySet().iterator();
while (i.hasNext()) {
Expand Down