Permalink
Browse files

support for empty objects, even when not clearly specified in json fo…

…rmat
  • Loading branch information...
grobmeier committed Mar 15, 2012
1 parent d689dd5 commit 400185e1ac03fc39a7abdd39278b8d2a61818a49
@@ -340,6 +340,12 @@ private JSONObject decodeObject() {
while(hasNext) {
// key must be a string
reader.next();
+
+ if(reader.current() == Closer.jsonobject.sign) {
+ hasNext = false;
+ return result;
+ }
+
JSONString key = decodeString();
while(reader.next()) {
@@ -237,4 +237,12 @@ public final void testNestedObjectSymbols() {
JSONValue result = decoder.decode();
TestCase.assertEquals(json, result.toJSON());
}
+
+ @Test
+ public final void testSomething() {
+ String json ="{\"roles\":{}}";
+ JSONDecoder decoder = new JSONDecoder(json);
+ JSONValue result = decoder.decode();
+ TestCase.assertEquals(json, result.toJSON());
+ }
}

0 comments on commit 400185e

Please sign in to comment.