Skip to content

Instantly share code, notes, and snippets.

@takaki
Last active July 5, 2016 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takaki/d32d6fc359d640c300ff6f540fabc426 to your computer and use it in GitHub Desktop.
Save takaki/d32d6fc359d640c300ff6f540fabc426 to your computer and use it in GitHub Desktop.
dependencies {
// https://mvnrepository.com/artifact/org.json/json
compile group: 'org.json', name: 'json', version: '20160212'
}
{"bb":{"e":"あ"},"a":"hoge","b":"bar","c":[1,3,5]}
{"bb":{"e":"あ"},"a":"hoge","b":"bar","c":[1,3,5]}
true
package example.misc;
import org.json.JSONObject;
public class JsonCompare {
public static void main(String[] args) {
final JSONObject o1 = new JSONObject("{\'a\': 'hoge', b: 'bar', c: [1,3,5], bb: {e: 'あ'}}");
final JSONObject o2 = new JSONObject("{b: 'bar', \nc:[1,\n3,5], a: \n'hoge', \"bb\": {e: '\\u3042'}}");
System.out.println(o1.toString());
System.out.println(o2.toString());
System.out.println(o1.toString().equals(o2.toString()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment