aMap = [a:1, b:2, c:3]
new JsonBuilder(aMap) // works as expected
aMap = [a:1, b:2, c:3].sort()
new JsonBuilder(aMap) // fails with a NullPointerException in 1.8.5. Works as expected in 1.8.4
I believe this issue may be related to commit c5456c808f0af5a. The sort() call returns a TreeMap and that is the root issue here, same error occurs for Hashtable (and Properties). A call to containsKey with a null key will throw a NPE for those Map implementations (unless used with a comparator that handles null keys).
def m = new TreeMap()
m.a = 1
In case it might be useful, I opened a pull request for this issue at https://github.com/groovy/groovy-core/pull/12.
Thanks for the pull request!