Skip to content

Commit 5b18f02

Browse files
null first
1 parent f9ef032 commit 5b18f02

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎JSONObject.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ of this software and associated documentation files (the "Software"), to deal
9090
* </ul>
9191
*
9292
* @author JSON.org
93-
* @version 2012-04-20
93+
* @version 2012-05-29
9494
*/
9595
publicclassJSONObject{
9696

@@ -1497,7 +1497,9 @@ public Writer write(Writer writer) throws JSONException{
14971497

14981498
staticfinalWriterwriteValue(Writerwriter, Objectvalue,
14991499
intindentFactor, intindent) throwsJSONException, IOException{
1500-
if (valueinstanceofJSONObject){
1500+
if (value == null || value.equals(null)){
1501+
writer.write("null");
1502+
} elseif (valueinstanceofJSONObject){
15011503
((JSONObject) value).write(writer, indentFactor, indent);
15021504
} elseif (valueinstanceofJSONArray){
15031505
((JSONArray) value).write(writer, indentFactor, indent);
@@ -1520,8 +1522,6 @@ static final Writer writeValue(Writer writer, Object value,
15201522
thrownewJSONException(e);
15211523
}
15221524
writer.write(o != null ? o.toString() : quote(value.toString()));
1523-
} elseif (value == null || value.equals(null)){
1524-
writer.write("null");
15251525
} else{
15261526
quote(value.toString(), writer);
15271527
}

0 commit comments

Comments
(0)