Browse Source

Fix issue in array and object property parsing

- Fix non-valid ending of object property
- Fix Array/Object bounding brackets/braces
- Implement tests
Alexey Edelev 5 years ago
parent
commit
ef36b8984d
2 changed files with 406 additions and 12 deletions
  1. 15 10
      microjson.cpp
  2. 391 2
      tests/main.cpp

+ 15 - 10
microjson.cpp

@@ -36,19 +36,21 @@
     static micorJsonNull nullout;
     #define micorJsonDebug nullout
 #endif
+
+namespace  {
+enum ParsingState {
+    LookingForNameBegin,
+    LookingForNameEnd,
+    LookingForSeparator,
+    LookingForValueBegin,
+    LookingForValueEnd
+};
+}
 size_t microjson::extractNextProperty(const char *buffer, size_t size, JsonProperty &property) {
     if (buffer == nullptr || size == 0 || size == SIZE_MAX) {
         return SIZE_MAX;
     }
 
-    enum ParsingState {
-        LookingForNameBegin,
-        LookingForNameEnd,
-        LookingForSeparator,
-        LookingForValueBegin,
-        LookingForValueEnd
-    };
-
     property.nameBegin = SIZE_MAX;
     property.nameEnd = SIZE_MAX;
     property.valueBegin = SIZE_MAX;
@@ -126,6 +128,7 @@ size_t microjson::extractNextProperty(const char *buffer, size_t size, JsonPrope
             case '9':
                 valueEndMarker = [&buffer, &i](){
                     if (buffer[i] != '+'
+                            && buffer[i] != '-'
                             && buffer[i] != '0'
                             && buffer[i] != '1'
                             && buffer[i] != '2'
@@ -186,7 +189,7 @@ size_t microjson::extractNextProperty(const char *buffer, size_t size, JsonPrope
                 --valueBracesCounter;
                 break;
             case '{':
-                --valueBracesCounter;
+                ++valueBracesCounter;
                 break;
             case ']':
                 --valueBracketsCounter;
@@ -215,7 +218,9 @@ size_t microjson::extractNextProperty(const char *buffer, size_t size, JsonPrope
 
     micorJsonDebug << property.nameBegin << " " << property.nameEnd << " " << property.valueBegin << " " << property.valueEnd << " " << property.type << std::endl;
     if (property.check()) {
-        if (property.type == JsonStringType) {
+        if (property.type == JsonStringType
+                || property.type == JsonArrayType
+                || property.type == JsonObjectType) {
             ++property.valueBegin;
             --property.valueEnd;
         }

+ 391 - 2
tests/main.cpp

@@ -25,7 +25,7 @@ TEST_F(MicrojsonDeserializationTest, StringValue)
     const char *buffer2 = "{\"testField\":\"\"}";
     size = strlen(buffer2);
     obj = microjson::parseObject(buffer2, size);
-    obj.find("testField");
+    it = obj.find("testField");
     ASSERT_TRUE(it != obj.end());
     EXPECT_STREQ(it->first.c_str(), "testField");
     EXPECT_EQ(it->second.type, microjson::JsonStringType);
@@ -127,7 +127,7 @@ TEST_F(MicrojsonDeserializationTest, NumberValue)
     const char *buffer2 = "{\"testField\":56}";
     size = strlen(buffer2);
     obj = microjson::parseObject(buffer2, size);
-    obj.find("testField");
+    it = obj.find("testField");
     ASSERT_TRUE(it != obj.end());
     EXPECT_STREQ(it->first.c_str(), "testField");
     EXPECT_EQ(it->second.type, microjson::JsonNumberType);
@@ -236,3 +236,392 @@ TEST_F(MicrojsonDeserializationTest, TextSpacesCutting)
     EXPECT_EQ(it->second.type, microjson::JsonStringType);
     EXPECT_STREQ(it->second.value.c_str(), "\\\"qwerty\t\t\t\t");
 }
+
+TEST_F(MicrojsonDeserializationTest, BooleanValue)
+{
+    const char *buffer1 = "{\"testField\":true}";
+    size_t size = strlen(buffer1);
+    microjson::JsonObject obj = microjson::parseObject(buffer1, size);
+    auto it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonBoolType);
+    EXPECT_STREQ(it->second.value.c_str(), "true");
+
+    obj.clear();
+    const char *buffer2 = "{\"testField\":false}";
+    size = strlen(buffer2);
+    obj = microjson::parseObject(buffer2, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonBoolType);
+    EXPECT_STREQ(it->second.value.c_str(), "false");
+    obj.clear();
+    const char *buffer7 = "{\"testField\":true,\"testField1\":false}";
+    size = strlen(buffer7);
+    obj = microjson::parseObject(buffer7, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonBoolType);
+    EXPECT_STREQ(it->second.value.c_str(), "true");
+
+    it = obj.find("testField1");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField1");
+    EXPECT_EQ(it->second.type, microjson::JsonBoolType);
+    EXPECT_STREQ(it->second.value.c_str(), "false");
+}
+
+TEST_F(MicrojsonDeserializationTest, FloatingPointValue)
+{
+    const char *buffer1 = "{\"testField\":0.0}";
+    size_t size = strlen(buffer1);
+    microjson::JsonObject obj = microjson::parseObject(buffer1, size);
+    auto it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "0.0");
+
+    obj.clear();
+    const char *buffer2 = "{\"testField\":1.0}";
+    size = strlen(buffer2);
+    obj = microjson::parseObject(buffer2, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "1.0");
+
+    obj.clear();
+    const char *buffer3 = "{\"testField\":20.0}";
+    size = strlen(buffer3);
+    obj = microjson::parseObject(buffer3, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "20.0");
+
+    obj.clear();
+    const char *buffer4 = "{\"testField\":20.01}";
+    size = strlen(buffer4);
+    obj = microjson::parseObject(buffer4, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "20.01");
+
+    obj.clear();
+    const char *buffer5 = "{\"testField\":-1.0}";
+    size = strlen(buffer5);
+    obj = microjson::parseObject(buffer5, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "-1.0");
+
+    obj.clear();
+    const char *buffer6 = "{\"testField\":-87.0}";
+    size = strlen(buffer6);
+    obj = microjson::parseObject(buffer6, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "-87.0");
+
+    obj.clear();
+    const char *buffer7 = "{\"testField\":-11.21}";
+    size = strlen(buffer7);
+    obj = microjson::parseObject(buffer7, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "-11.21");
+
+    obj.clear();
+    const char *buffer8 = "{\"testField\":1.1234+e10}";
+    size = strlen(buffer8);
+    obj = microjson::parseObject(buffer8, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "1.1234+e10");
+
+    obj.clear();
+    const char *buffer9 = "{\"testField\":1.1234-e10}";
+    size = strlen(buffer9);
+    obj = microjson::parseObject(buffer9, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "1.1234-e10");
+
+    obj.clear();
+    const char *buffer10 = "{\"testField\":-1.1234-e10}";
+    size = strlen(buffer10);
+    obj = microjson::parseObject(buffer10, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "-1.1234-e10");
+
+    obj.clear();
+    const char *buffer11 = "{\"testField\":-1.1234+e10}";
+    size = strlen(buffer11);
+    obj = microjson::parseObject(buffer11, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "-1.1234+e10");
+
+    obj.clear();
+    const char *buffer12 = "{\"testField\":0.0,\"testField1\":1.0,\"testField2\":20.0,\"testField3\":20.01,\"testField4\":-1.0,\"testField5\":-87.0,\"testField6\":-11.21,\"testField7\":1.1234+e10,\"testField8\":1.1234-e10,\"testField9\":-1.1234-e10,\"testField10\":-1.1234+e10}";
+    size = strlen(buffer12);
+    obj = microjson::parseObject(buffer12, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "0.0");
+
+    it = obj.find("testField1");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField1");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "1.0");
+
+    it = obj.find("testField2");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField2");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "20.0");
+
+    it = obj.find("testField3");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField3");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "20.01");
+
+    it = obj.find("testField4");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField4");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "-1.0");
+
+    it = obj.find("testField5");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField5");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "-87.0");
+
+    it = obj.find("testField6");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField6");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "-11.21");
+
+    it = obj.find("testField7");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField7");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "1.1234+e10");
+
+    it = obj.find("testField8");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField8");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "1.1234-e10");
+
+    it = obj.find("testField9");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField9");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "-1.1234-e10");
+
+    it = obj.find("testField10");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField10");
+    EXPECT_EQ(it->second.type, microjson::JsonNumberType);
+    EXPECT_STREQ(it->second.value.c_str(), "-1.1234+e10");
+}
+
+TEST_F(MicrojsonDeserializationTest, ArrayValue)
+{
+    const char *buffer1 = "{\"testField\":[\"test1\"]}";
+    size_t size = strlen(buffer1);
+    microjson::JsonObject obj = microjson::parseObject(buffer1, size);
+    auto it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonArrayType);
+    EXPECT_STREQ(it->second.value.c_str(), "\"test1\"");
+
+    obj.clear();
+    const char *buffer2 = "{\"testField\":[\"test1\",\"test2\",\"test3\",\"test5\",\"test6\"]}";
+    size = strlen(buffer2);
+    obj = microjson::parseObject(buffer2, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonArrayType);
+    EXPECT_STREQ(it->second.value.c_str(), "\"test1\",\"test2\",\"test3\",\"test5\",\"test6\"");
+
+    obj.clear();
+    const char *buffer3 = "{\"testField\":[],\"testField1\":[\"test1\",\"test2\"]}";
+    size = strlen(buffer3);
+    obj = microjson::parseObject(buffer3, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonArrayType);
+    EXPECT_STREQ(it->second.value.c_str(), "");
+    it = obj.find("testField1");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField1");
+    EXPECT_EQ(it->second.type, microjson::JsonArrayType);
+    EXPECT_STREQ(it->second.value.c_str(), "\"test1\",\"test2\"");
+
+    obj.clear();
+    const char *buffer4 = "{\"testField\":[1,1.0,-10,\"test1\",{\"test2\":15}]}";
+    size = strlen(buffer4);
+    obj = microjson::parseObject(buffer4, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonArrayType);
+    EXPECT_STREQ(it->second.value.c_str(), "1,1.0,-10,\"test1\",{\"test2\":15}");
+
+    obj.clear();
+    const char *buffer5 = "{\"testField\":[[1,2,3,4,5,6],[7,8,9,10,\"test1\"]]}";
+    size = strlen(buffer5);
+    obj = microjson::parseObject(buffer5, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonArrayType);
+    EXPECT_STREQ(it->second.value.c_str(), "[1,2,3,4,5,6],[7,8,9,10,\"test1\"]");
+
+    obj.clear();
+    const char *buffer6 = "{\"testField\":[{\"test1\":[1,2,3,4,5,{\"test2\":[\"test3\",\"test4\",[1,2,3,4]]}]}]}";
+    size = strlen(buffer6);
+    obj = microjson::parseObject(buffer6, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonArrayType);
+    EXPECT_STREQ(it->second.value.c_str(), "{\"test1\":[1,2,3,4,5,{\"test2\":[\"test3\",\"test4\",[1,2,3,4]]}]}");
+
+    const char *buffer7 = "{\"testField\":[\"test1\"],\"testField1\":[\"test1\",\"test2\",\"test3\",\"test5\",\"test6\"],\"testField2\":[],\"testField3\":[\"test1\",\"test2\"],\"testField4\":[1,1.0,-10,\"test1\",{\"test2\":15}],\"testField5\":[[1,2,3,4,5,6],[7,8,9,10,\"test1\"]],\"testField6\":[{\"test1\":[1,2,3,4,5,{\"test2\":[\"test3\",\"test4\",[1,2,3,4]]}]}]}";
+    size = strlen(buffer7);
+    obj = microjson::parseObject(buffer7, size);
+
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonArrayType);
+    EXPECT_STREQ(it->second.value.c_str(), "\"test1\"");
+
+    it = obj.find("testField1");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField1");
+    EXPECT_EQ(it->second.type, microjson::JsonArrayType);
+    EXPECT_STREQ(it->second.value.c_str(), "\"test1\",\"test2\",\"test3\",\"test5\",\"test6\"");
+
+    it = obj.find("testField2");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField2");
+    EXPECT_EQ(it->second.type, microjson::JsonArrayType);
+    EXPECT_STREQ(it->second.value.c_str(), "");
+
+    it = obj.find("testField3");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField3");
+    EXPECT_EQ(it->second.type, microjson::JsonArrayType);
+    EXPECT_STREQ(it->second.value.c_str(), "\"test1\",\"test2\"");
+
+    it = obj.find("testField4");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField4");
+    EXPECT_EQ(it->second.type, microjson::JsonArrayType);
+    EXPECT_STREQ(it->second.value.c_str(), "1,1.0,-10,\"test1\",{\"test2\":15}");
+
+    it = obj.find("testField5");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField5");
+    EXPECT_EQ(it->second.type, microjson::JsonArrayType);
+    EXPECT_STREQ(it->second.value.c_str(), "[1,2,3,4,5,6],[7,8,9,10,\"test1\"]");
+
+    it = obj.find("testField6");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField6");
+    EXPECT_EQ(it->second.type, microjson::JsonArrayType);
+    EXPECT_STREQ(it->second.value.c_str(), "{\"test1\":[1,2,3,4,5,{\"test2\":[\"test3\",\"test4\",[1,2,3,4]]}]}");
+}
+
+TEST_F(MicrojsonDeserializationTest, ObjectValue)
+{
+    const char *buffer1 = "{\"testField\":{\"testField1\":1}}";
+    size_t size = strlen(buffer1);
+    microjson::JsonObject obj = microjson::parseObject(buffer1, size);
+    auto it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonObjectType);
+    EXPECT_STREQ(it->second.value.c_str(), "\"testField1\":1");
+
+    const char *buffer2 = "{\"testField\":{\"testField1\":1,\"testField2\":2}}";
+    size = strlen(buffer2);
+    obj = microjson::parseObject(buffer2, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonObjectType);
+    EXPECT_STREQ(it->second.value.c_str(), "\"testField1\":1,\"testField2\":2");
+
+    const char *buffer3 = "{\"testField\":{\"testField1\":1.0,\"testField2\":\"2\"}}";
+    size = strlen(buffer3);
+    obj = microjson::parseObject(buffer3, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonObjectType);
+    EXPECT_STREQ(it->second.value.c_str(), "\"testField1\":1.0,\"testField2\":\"2\"");
+
+    const char *buffer4 = "{\"testField\":{}}";
+    size = strlen(buffer4);
+    obj = microjson::parseObject(buffer4, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonObjectType);
+    EXPECT_STREQ(it->second.value.c_str(), "");
+
+    const char *buffer5 = "{\"testField\":{\"testField1\":{},\"testField2\":{\"testField3\":\"2\"}}}";
+    size = strlen(buffer5);
+    obj = microjson::parseObject(buffer5, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonObjectType);
+    EXPECT_STREQ(it->second.value.c_str(), "\"testField1\":{},\"testField2\":{\"testField3\":\"2\"}");
+
+    const char *buffer6 = "{\"testField\":{\"testField1\":{},\"testField2\":{\"testField3\":[\"2\",0,1,2,{\"testField4\":9}]}}}";
+    size = strlen(buffer6);
+    obj = microjson::parseObject(buffer6, size);
+    it = obj.find("testField");
+    ASSERT_TRUE(it != obj.end());
+    EXPECT_STREQ(it->first.c_str(), "testField");
+    EXPECT_EQ(it->second.type, microjson::JsonObjectType);
+    EXPECT_STREQ(it->second.value.c_str(), "\"testField1\":{},\"testField2\":{\"testField3\":[\"2\",0,1,2,{\"testField4\":9}]}");
+}