Skip to content

Commit

Permalink
Working on improving JSON null handling
Browse files Browse the repository at this point in the history
Relates to #9129
  • Loading branch information
Jeff Scott Brown committed Jul 28, 2015
1 parent 6eb924e commit 76829a2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
@@ -0,0 +1,12 @@
package grails.converters

import spock.lang.Specification

class ParsingNullJsonValuesSpec extends Specification {

def "test parsing null value"() {
expect:
JSON.parse("{'myList':null}").myList == null
JSON.parse("{'myList':null}").get('myList') == null
}
}
Expand Up @@ -331,7 +331,7 @@ public Object get(String key) throws JSONException {
throw new JSONException("JSONObject[" + quote(key) +
"] not found.");
}
return o;
return o instanceof Null ? null : o;
}


Expand Down Expand Up @@ -1246,7 +1246,8 @@ public boolean containsValue(Object o) {
}

public Object get(Object o) {
return myHashMap.get(o);
Object value = myHashMap.get(o);
return value instanceof Null ? null : value;
}

public Object put(Object o, Object o1) {
Expand Down

0 comments on commit 76829a2

Please sign in to comment.