Fix JSON parser handling for certain objects (#7162)

This PR also adds some comments and simplifies
the code. Primary handling is done to ensure
that we make sure to honor cached buffer.

Added unit tests as well

Fixes #7141
This commit is contained in:
Harshavardhana
2019-02-06 18:34:42 -08:00
committed by Nitish Tiwari
parent d203e7e1cc
commit 85e939636f
22 changed files with 1016 additions and 166 deletions

View File

@@ -0,0 +1,12 @@
[
{
"key_1": "value",
"key_2": "value"
}
]
[
{
"key_1": "value2",
"key_2": "value3"
}
]

View File

@@ -0,0 +1,8 @@
"a"
1
3.145
["a"]
{}
{
"a": 1
}

View File

@@ -0,0 +1,5 @@
{
"a": 1
}{
"b": 2
}

View File

@@ -0,0 +1 @@
{"text": "hello world\\n2nd line"}

View File

@@ -0,0 +1 @@
{"hello":"wor{l}d"}

View File

@@ -0,0 +1,26 @@
{
"id": "0001",
"type": "donut",
"name": "Cake",
"ppu": 0.55,
"batters":
{
"batter":
[
{ "id": "1001", "type": "Regular" },
{ "id": "1002", "type": "Chocolate" },
{ "id": "1003", "type": "Blueberry" },
{ "id": "1004", "type": "Devil's Food" }
]
},
"topping":
[
{ "id": "5001", "type": "None" },
{ "id": "5002", "type": "Glazed" },
{ "id": "5005", "type": "Sugar" },
{ "id": "5007", "type": "Powdered Sugar" },
{ "id": "5006", "type": "Chocolate with Sprinkles" },
{ "id": "5003", "type": "Chocolate" },
{ "id": "5004", "type": "Maple" }
]
}

View File

@@ -0,0 +1,5 @@
{
"foo": {
"bar": "baz"
}
}

View File

@@ -0,0 +1 @@
{ "name": "John", "age":28, "hobby": { "name": "chess", "type": "boardgame" }}

View File

@@ -0,0 +1,3 @@
{"name":"Michael", "age": 31}
{"name":"Andy", "age": 30}
{"name":"Justin", "age": 19}

View File

@@ -0,0 +1,2 @@
{"a":"}"
}

View File

@@ -0,0 +1,6 @@
[
{
"key_1": "value",
"key_2": "value"
}
]