Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.8.4
-
Fix Version/s: 1.8.5, 2.0-beta-2
-
Component/s: groovy-jdk
-
Labels:
-
Environment:Mac Java 6
-
Number of attachments :
Description
import groovy.json.JsonOutput def group = [1, 2, null].countBy{it} def result = use (JsonOutput) { group.toJson() }
throws NullPointerException due to the presence of a null a as key to map entry.
The stacktrace is rather unhelpful, so it would be nice if the JsonOutput would translate this to indicate a problem with the map content.
http://groovyconsole.appspot.com/script/601001
Just tried to see how Jackson JSON mapper handles the null key in a map and that rejects it saying "Null key for a Map not allowed in Json"
Is it ok to have the same behavior in JsonOutput and reject the null key in a map?