Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…rmat
  • Loading branch information...
commit 400185e1ac03fc39a7abdd39278b8d2a61818a49 1 parent d689dd5
@grobmeier authored
View
6 jjson/src/main/java/de/grobmeier/jjson/convert/JSONDecoder.java
@@ -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()) {
View
8 jjson/src/test/java/de/grobmeier/jjson/convert/JSONDecoderTest.java
@@ -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());
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.