restore-jsonparserconfiguration: strict mode initial attempt. Still missing all JSONObject test cases and strict mode sanity check. Might be able to simplify implementation a bit more

This commit is contained in:
Sean Leary 2024-12-14 14:40:40 -06:00
parent 80b2672f77
commit 1f0729cadb
5 changed files with 679 additions and 6 deletions

View File

@ -67,6 +67,10 @@ public class JSONArray implements Iterable<Object> {
*/
private final ArrayList<Object> myArrayList;
private JSONTokener jsonTokener;
private JSONParserConfiguration jsonParserConfiguration;
/**
* Construct an empty JSONArray.
*/
@ -95,6 +99,15 @@ public class JSONArray implements Iterable<Object> {
*/
public JSONArray(JSONTokener x, JSONParserConfiguration jsonParserConfiguration) throws JSONException {
this();
if (this.jsonParserConfiguration == null) {
this.jsonParserConfiguration = jsonParserConfiguration;
}
if (this.jsonTokener == null) {
this.jsonTokener = x;
this.jsonTokener.setJsonParserConfiguration(this.jsonParserConfiguration);
}
if (x.nextClean() != '[') {
throw x.syntaxError("A JSONArray text must start with '['");
}
@ -125,6 +138,9 @@ public class JSONArray implements Iterable<Object> {
throw x.syntaxError("Expected a ',' or ']'");
}
if (nextChar == ']') {
if (jsonParserConfiguration.isStrictMode()) {
throw x.syntaxError("Expected another array element");
}
return;
}
x.back();
@ -136,7 +152,6 @@ public class JSONArray implements Iterable<Object> {
}
}
}
}
/**
@ -151,6 +166,13 @@ public class JSONArray implements Iterable<Object> {
*/
public JSONArray(String source) throws JSONException {
this(source, new JSONParserConfiguration());
if (this.jsonParserConfiguration.isStrictMode()) {
char c = jsonTokener.nextClean();
if (c != 0) {
throw jsonTokener.syntaxError(String.format("invalid character '%s' found after end of array", c));
}
}
}
/**
@ -166,6 +188,13 @@ public class JSONArray implements Iterable<Object> {
*/
public JSONArray(String source, JSONParserConfiguration jsonParserConfiguration) throws JSONException {
this(new JSONTokener(source), jsonParserConfiguration);
if (this.jsonParserConfiguration.isStrictMode()) {
char c = jsonTokener.nextClean();
if (c != 0) {
throw jsonTokener.syntaxError(String.format("invalid character '%s' found after end of array", c));
}
}
}
/**

View File

@ -152,6 +152,10 @@ public class JSONObject {
*/
public static final Object NULL = new Null();
private JSONTokener jsonTokener;
private JSONParserConfiguration jsonParserConfiguration;
/**
* Construct an empty JSONObject.
*/
@ -211,6 +215,15 @@ public class JSONObject {
*/
public JSONObject(JSONTokener x, JSONParserConfiguration jsonParserConfiguration) throws JSONException {
this();
if (this.jsonParserConfiguration == null) {
this.jsonParserConfiguration = jsonParserConfiguration;
}
if (this.jsonTokener == null) {
this.jsonTokener = x;
this.jsonTokener.setJsonParserConfiguration(this.jsonParserConfiguration);
}
char c;
String key;
@ -433,6 +446,10 @@ public class JSONObject {
*/
public JSONObject(String source) throws JSONException {
this(source, new JSONParserConfiguration());
if (this.jsonParserConfiguration.isStrictMode() &&
this.jsonTokener.nextClean() != 0) {
throw new JSONException("Unparsed characters found at end of input text");
}
}
/**

View File

@ -32,6 +32,7 @@ public class JSONTokener {
/** the number of characters read in the previous line. */
private long characterPreviousLine;
private JSONParserConfiguration jsonParserConfiguration;
/**
* Construct a JSONTokener from a Reader. The caller must close the Reader.
@ -70,6 +71,21 @@ public class JSONTokener {
this(new StringReader(s));
}
/**
* Getter
* @return jsonParserConfiguration
*/
public JSONParserConfiguration getJsonParserConfiguration() {
return jsonParserConfiguration;
}
/**
* Setter
* @param jsonParserConfiguration new value for jsonParserConfiguration
*/
public void setJsonParserConfiguration(JSONParserConfiguration jsonParserConfiguration) {
this.jsonParserConfiguration = jsonParserConfiguration;
}
/**
* Back up one character. This provides a sort of lookahead capability,
@ -409,14 +425,14 @@ public class JSONTokener {
case '{':
this.back();
try {
return new JSONObject(this);
return new JSONObject(this, jsonParserConfiguration);
} catch (StackOverflowError e) {
throw new JSONException("JSON Array or Object depth too large to process.", e);
}
case '[':
this.back();
try {
return new JSONArray(this);
return new JSONArray(this, jsonParserConfiguration);
} catch (StackOverflowError e) {
throw new JSONException("JSON Array or Object depth too large to process.", e);
}
@ -427,6 +443,11 @@ public class JSONTokener {
Object nextSimpleValue(char c) {
String string;
if (jsonParserConfiguration != null &&
jsonParserConfiguration.isStrictMode() &&
c == '\'') {
throw this.syntaxError("Single quote wrap not allowed in strict mode");
}
switch (c) {
case '"':
case '\'':
@ -455,7 +476,13 @@ public class JSONTokener {
if ("".equals(string)) {
throw this.syntaxError("Missing value");
}
return JSONObject.stringToValue(string);
Object obj = JSONObject.stringToValue(string);
if (jsonParserConfiguration != null &&
jsonParserConfiguration.isStrictMode() &&
obj instanceof String) {
throw this.syntaxError(String.format("Value '%s' is not surrounded by quotes", obj));
}
return obj;
}

View File

@ -1,12 +1,21 @@
package org.json.junit;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONParserConfiguration;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.junit.Assert.*;
public class JSONParserConfigurationTest {
private static final String TEST_SOURCE = "{\"key\": \"value1\", \"key\": \"value2\"}";
@ -43,4 +52,278 @@ public class JSONParserConfigurationTest {
assertTrue(jsonParserConfiguration.isOverwriteDuplicateKey());
assertEquals(42, jsonParserConfiguration.getMaxNestingDepth());
}
@Test
public void givenInvalidInputArrays_testStrictModeTrue_shouldThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
List<String> strictModeInputTestCases = getNonCompliantJSONList();
// this is a lot easier to debug when things stop working
for (int i = 0; i < strictModeInputTestCases.size(); ++i) {
String testCase = strictModeInputTestCases.get(i);
try {
JSONArray jsonArray = new JSONArray(testCase, jsonParserConfiguration);
String s = jsonArray.toString();
System.out.println("Expected an exception, but got: " + s + " Noncompliant Array index: " + i);
} catch (Exception e) {
// its all good
}
}
}
@Test
public void givenEmptyArray_testStrictModeTrue_shouldNotThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[]";
JSONArray jsonArray = new JSONArray(testCase, jsonParserConfiguration);
assertEquals(testCase, jsonArray.toString());
}
@Test
public void givenValidDoubleArray_testStrictModeTrue_shouldNotThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[[\"c\"], [10.2], [true, false, true]]";
JSONArray jsonArray = new JSONArray(testCase, jsonParserConfiguration);
JSONArray arrayShouldContainStringAt0 = jsonArray.getJSONArray(0);
JSONArray arrayShouldContainNumberAt0 = jsonArray.getJSONArray(1);
JSONArray arrayShouldContainBooleanAt0 = jsonArray.getJSONArray(2);
assertTrue(arrayShouldContainStringAt0.get(0) instanceof String);
assertTrue(arrayShouldContainNumberAt0.get(0) instanceof Number);
assertTrue(arrayShouldContainBooleanAt0.get(0) instanceof Boolean);
}
@Test
public void givenValidEmptyArrayInsideArray_testStrictModeTrue_shouldNotThrowJsonException(){
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[[]]";
JSONArray jsonArray = new JSONArray(testCase, jsonParserConfiguration);
assertEquals(testCase, jsonArray.toString());
}
@Test
public void givenValidEmptyArrayInsideArray_testStrictModeFalse_shouldNotThrowJsonException(){
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(false);
String testCase = "[[]]";
JSONArray jsonArray = new JSONArray(testCase, jsonParserConfiguration);
assertEquals(testCase, jsonArray.toString());
}
@Test
public void givenInvalidString_testStrictModeTrue_shouldThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[badString]";
JSONException je = assertThrows(JSONException.class, () -> new JSONArray(testCase, jsonParserConfiguration));
assertEquals("Value 'badString' is not surrounded by quotes at 10 [character 11 line 1]", je.getMessage());
}
@Test
public void allowNullInStrictMode() {
String expected = "[null]";
JSONArray jsonArray = new JSONArray(expected, new JSONParserConfiguration().withStrictMode(true));
assertEquals(expected, jsonArray.toString());
}
@Test
public void shouldHandleNumericArray() {
String expected = "[10]";
JSONArray jsonArray = new JSONArray(expected, new JSONParserConfiguration().withStrictMode(true));
assertEquals(expected, jsonArray.toString());
}
@Test
public void givenCompliantJSONArrayFile_testStrictModeTrue_shouldNotThrowAnyException() throws IOException {
try (Stream<String> lines = Files.lines(Paths.get("src/test/resources/compliantJsonArray.json"))) {
String compliantJsonArrayAsString = lines.collect(Collectors.joining());
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
new JSONArray(compliantJsonArrayAsString, jsonParserConfiguration);
}
}
@Test
public void givenInvalidInputArrays_testStrictModeFalse_shouldNotThrowAnyException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(false);
List<String> strictModeInputTestCases = getNonCompliantJSONList();
// this is a lot easier to debug when things stop working
for (int i = 0; i < strictModeInputTestCases.size(); ++i) {
String testCase = strictModeInputTestCases.get(i);
try {
JSONArray jsonArray = new JSONArray(testCase, jsonParserConfiguration);
} catch (Exception e) {
System.out.println("Unexpected exception: " + e.getMessage() + " Noncompliant Array index: " + i);
}
}
strictModeInputTestCases.forEach(testCase -> new JSONArray(testCase, jsonParserConfiguration));
}
@Test
public void givenInvalidInputArray_testStrictModeTrue_shouldThrowInvalidCharacterErrorMessage() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[1,2];[3,4]";
JSONException je = assertThrows("expected non-compliant array but got instead: " + testCase,
JSONException.class, () -> new JSONArray(testCase, jsonParserConfiguration));
assertEquals("invalid character ';' found after end of array at 6 [character 7 line 1]", je.getMessage());
}
@Test
public void givenInvalidInputArrayWithNumericStrings_testStrictModeTrue_shouldThrowInvalidCharacterErrorMessage() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[\"1\",\"2\"];[3,4]";
JSONException je = assertThrows("expected non-compliant array but got instead: " + testCase,
JSONException.class, () -> new JSONArray(testCase, jsonParserConfiguration));
assertEquals("invalid character ';' found after end of array at 10 [character 11 line 1]", je.getMessage());
}
@Test
public void givenInvalidInputArray_testStrictModeTrue_shouldThrowValueNotSurroundedByQuotesErrorMessage() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[{\"test\": implied}]";
JSONException je = assertThrows("expected non-compliant array but got instead: " + testCase,
JSONException.class, () -> new JSONArray(testCase, jsonParserConfiguration));
assertEquals("Value 'implied' is not surrounded by quotes at 17 [character 18 line 1]", je.getMessage());
}
@Test
public void givenInvalidInputArray_testStrictModeFalse_shouldNotThrowAnyException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(false);
String testCase = "[{\"test\": implied}]";
new JSONArray(testCase, jsonParserConfiguration);
}
@Test
public void givenNonCompliantQuotes_testStrictModeTrue_shouldThrowJsonExceptionWithConcreteErrorDescription() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCaseOne = "[\"abc', \"test\"]";
String testCaseTwo = "['abc\", \"test\"]";
String testCaseThree = "['abc']";
String testCaseFour = "[{'testField': \"testValue\"}]";
JSONException jeOne = assertThrows(JSONException.class,
() -> new JSONArray(testCaseOne, jsonParserConfiguration));
JSONException jeTwo = assertThrows(JSONException.class,
() -> new JSONArray(testCaseTwo, jsonParserConfiguration));
JSONException jeThree = assertThrows(JSONException.class,
() -> new JSONArray(testCaseThree, jsonParserConfiguration));
JSONException jeFour = assertThrows(JSONException.class,
() -> new JSONArray(testCaseFour, jsonParserConfiguration));
assertEquals(
"Expected a ',' or ']' at 10 [character 11 line 1]",
jeOne.getMessage());
assertEquals(
"Single quote wrap not allowed in strict mode at 2 [character 3 line 1]",
jeTwo.getMessage());
assertEquals(
"Single quote wrap not allowed in strict mode at 2 [character 3 line 1]",
jeThree.getMessage());
assertEquals(
"Single quote wrap not allowed in strict mode at 3 [character 4 line 1]",
jeFour.getMessage());
}
@Test
public void givenUnbalancedQuotes_testStrictModeFalse_shouldThrowJsonException() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(false);
String testCaseOne = "[\"abc', \"test\"]";
String testCaseTwo = "['abc\", \"test\"]";
JSONException jeOne = assertThrows(JSONException.class,
() -> new JSONArray(testCaseOne, jsonParserConfiguration));
JSONException jeTwo = assertThrows(JSONException.class,
() -> new JSONArray(testCaseTwo, jsonParserConfiguration));
assertEquals("Expected a ',' or ']' at 10 [character 11 line 1]", jeOne.getMessage());
assertEquals("Unterminated string. Character with int code 0 is not allowed within a quoted string. at 15 [character 16 line 1]", jeTwo.getMessage());
}
@Test
public void givenInvalidInputArray_testStrictModeTrue_shouldThrowKeyNotSurroundedByQuotesErrorMessage() {
JSONParserConfiguration jsonParserConfiguration = new JSONParserConfiguration()
.withStrictMode(true);
String testCase = "[{test: implied}]";
JSONException je = assertThrows("expected non-compliant array but got instead: " + testCase,
JSONException.class, () -> new JSONArray(testCase, jsonParserConfiguration));
assertEquals("Value 'test' is not surrounded by quotes at 6 [character 7 line 1]", je.getMessage());
}
/**
* This method contains short but focused use-case samples and is exclusively used to test strictMode unit tests in
* this class.
*
* @return List with JSON strings.
*/
private List<String> getNonCompliantJSONList() {
return Arrays.asList(
"[1],",
"[1,]",
"[[1],\"sa\",[2]]a",
"[1],\"dsa\": \"test\"",
"[[a]]",
"[]asdf",
"[]]",
"[]}",
"[][",
"[]{",
"[],",
"[]:",
"[],[",
"[],{",
"[1,2];[3,4]",
"[test]",
"[{'testSingleQuote': 'testSingleQuote'}]",
"[1, 2,3]:[4,5]",
"[{test: implied}]",
"[{\"test\": implied}]",
"[{\"number\":\"7990154836330\",\"color\":'c'},{\"number\":8784148854580,\"color\":RosyBrown},{\"number\":\"5875770107113\",\"color\":\"DarkSeaGreen\"}]",
"[{test: \"implied\"}]");
}
}

View File

@ -0,0 +1,317 @@
[
{
"_id": "6606c27d2ab4a0102d49420a",
"index": 0,
"guid": "441331fb-84d1-4873-a649-3814621a0370",
"isActive": true,
"balance": "$2,691.63",
"picture": "http://example.abc/32x32",
"age": 26,
"eyeColor": "blue",
"name": "abc",
"gender": "female",
"company": "example",
"email": "abc@def.com",
"phone": "+1 (123) 456-7890",
"address": "123 Main St",
"about": "Laborum magna tempor officia irure cillum nulla incididunt Lorem dolor veniam elit cupidatat amet. Veniam veniam exercitation nulla consectetur officia esse ex sunt nulla nisi ea cillum nisi reprehenderit. Qui aliquip reprehenderit aliqua aliquip aliquip anim sit magna nostrud dolore veniam velit elit aliquip.\r\n",
"registered": "2016-07-22T03:18:11 -01:00",
"latitude": -21.544934,
"longitude": 72.765495,
"tags": [
"consectetur",
"minim",
"sunt",
"in",
"ut",
"velit",
"anim"
],
"friends": [
{
"id": 0,
"name": "abc def"
},
{
"id": 1,
"name": "ghi jkl"
},
{
"id": 2,
"name": "mno pqr"
}
],
"greeting": "Hello, abc! You have 10 unread messages.",
"favoriteFruit": "banana"
},
{
"_id": "6606c27d0a45df5121fb765f",
"index": 1,
"guid": "fd774715-de85-44b9-b498-c214d8f68d9f",
"isActive": true,
"balance": "$2,713.96",
"picture": "http://placehold.it/32x32",
"age": 27,
"eyeColor": "green",
"name": "def",
"gender": "female",
"company": "sample",
"email": "def@abc.com",
"phone": "+1 (123) 456-78910",
"address": "1234 Main St",
"about": "Ea id cupidatat eiusmod culpa. Nulla consequat esse elit enim et pariatur eiusmod ipsum. Consequat eu non reprehenderit in.\r\n",
"registered": "2015-04-06T07:54:22 -01:00",
"latitude": 83.512347,
"longitude": -9.368739,
"tags": [
"excepteur",
"non",
"nostrud",
"laboris",
"laboris",
"qui",
"aute"
],
"friends": [
{
"id": 0,
"name": "sample example"
},
{
"id": 1,
"name": "test name"
},
{
"id": 2,
"name": "aaa aaaa"
}
],
"greeting": "Hello, test! You have 7 unread messages.",
"favoriteFruit": "apple"
},
{
"_id": "6606c27dfb3a0e4e7e7183d3",
"index": 2,
"guid": "688b0c36-98e0-4ee7-86b8-863638d79b5f",
"isActive": false,
"balance": "$3,514.35",
"picture": "http://placehold.it/32x32",
"age": 32,
"eyeColor": "green",
"name": "test",
"gender": "female",
"company": "test",
"email": "test@test.com",
"phone": "+1 (123) 456-7890",
"address": "123 Main St",
"about": "Mollit officia adipisicing ex nisi non Lorem sunt quis est. Irure exercitation duis ipsum qui ullamco eu ea commodo occaecat minim proident. Incididunt nostrud ex cupidatat eiusmod mollit anim irure culpa. Labore voluptate voluptate labore nisi sit eu. Dolor sit proident velit dolor deserunt labore sit ipsum incididunt eiusmod reprehenderit voluptate. Duis anim velit officia laboris consequat officia dolor sint dolor nisi ex.\r\n",
"registered": "2021-11-02T12:50:05 -00:00",
"latitude": -82.969939,
"longitude": 86.415645,
"tags": [
"aliquip",
"et",
"est",
"nulla",
"nulla",
"tempor",
"adipisicing"
],
"friends": [
{
"id": 0,
"name": "test"
},
{
"id": 1,
"name": "sample"
},
{
"id": 2,
"name": "example"
}
],
"greeting": "Hello, test! You have 1 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "6606c27d204bc2327fc9ba23",
"index": 3,
"guid": "be970cba-306e-4cbd-be08-c265a43a61fa",
"isActive": true,
"balance": "$3,691.63",
"picture": "http://placehold.it/32x32",
"age": 35,
"eyeColor": "brown",
"name": "another test",
"gender": "male",
"company": "TEST",
"email": "anothertest@anothertest.com",
"phone": "+1 (321) 987-6543",
"address": "123 Example Main St",
"about": "Do proident consectetur minim quis. In adipisicing culpa Lorem fugiat cillum exercitation velit velit. Non voluptate laboris deserunt veniam et sint consectetur irure aliqua quis eiusmod consectetur elit id. Ex sint do anim Lorem excepteur eu nulla.\r\n",
"registered": "2020-06-25T04:55:25 -01:00",
"latitude": 63.614955,
"longitude": -109.299405,
"tags": [
"irure",
"esse",
"non",
"mollit",
"laborum",
"adipisicing",
"ad"
],
"friends": [
{
"id": 0,
"name": "test"
},
{
"id": 1,
"name": "sample"
},
{
"id": 2,
"name": "example"
}
],
"greeting": "Hello, another test! You have 5 unread messages.",
"favoriteFruit": "apple"
},
{
"_id": "6606c27df63eb5f390cb9989",
"index": 4,
"guid": "2c3e5115-758d-468e-99c5-c9afa26e1f9f",
"isActive": true,
"balance": "$1,047.20",
"picture": "http://test.it/32x32",
"age": 30,
"eyeColor": "green",
"name": "Test Name",
"gender": "female",
"company": "test",
"email": "testname@testname.com",
"phone": "+1 (999) 999-9999",
"address": "999 Test Main St",
"about": "Voluptate exercitation tempor consectetur velit magna ea occaecat cupidatat consectetur anim aute. Aliquip est aute ipsum laboris non irure qui consectetur tempor quis do ea Lorem. Cupidatat exercitation ad culpa aliqua amet commodo mollit reprehenderit exercitation adipisicing amet et laborum pariatur.\r\n",
"registered": "2023-01-19T02:43:18 -00:00",
"latitude": 14.15208,
"longitude": 170.411535,
"tags": [
"dolor",
"qui",
"cupidatat",
"aliqua",
"laboris",
"reprehenderit",
"sint"
],
"friends": [
{
"id": 0,
"name": "test"
},
{
"id": 1,
"name": "sample"
},
{
"id": 2,
"name": "example"
}
],
"greeting": "Hello, test! You have 6 unread messages.",
"favoriteFruit": "apple"
},
{
"_id": "6606c27d01d19fa29853d59c",
"index": 5,
"guid": "816cda74-5d4b-498f-9724-20f340d5f5bf",
"isActive": false,
"balance": "$2,628.74",
"picture": "http://testing.it/32x32",
"age": 28,
"eyeColor": "green",
"name": "Testing",
"gender": "female",
"company": "test",
"email": "testing@testing.com",
"phone": "+1 (888) 888-8888",
"address": "123 Main St",
"about": "Cupidatat non ut nulla qui excepteur in minim non et nulla fugiat. Dolor quis laborum occaecat veniam dolor ullamco deserunt amet veniam dolor quis proident tempor laboris. In cillum duis ut quis. Aliqua cupidatat magna proident velit tempor veniam et consequat laborum ex dolore qui. Incididunt deserunt magna minim Lorem consectetur.\r\n",
"registered": "2017-10-14T11:14:08 -01:00",
"latitude": -5.345728,
"longitude": -9.706491,
"tags": [
"officia",
"velit",
"laboris",
"qui",
"cupidatat",
"cupidatat",
"ad"
],
"friends": [
{
"id": 0,
"name": "test"
},
{
"id": 1,
"name": "sample"
},
{
"id": 2,
"name": "example"
}
],
"greeting": "Hello, testing! You have 2 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "6606c27d803003cede1d6deb",
"index": 6,
"guid": "4ee550bc-0920-4104-b3ce-ebf9db6a803f",
"isActive": true,
"balance": "$1,709.31",
"picture": "http://sample.it/32x32",
"age": 31,
"eyeColor": "blue",
"name": "Sample Name",
"gender": "female",
"company": "Sample",
"email": "sample@sample.com",
"phone": "+1 (777) 777-7777",
"address": "123 Main St",
"about": "Lorem ex proident ipsum ullamco velit sit nisi eiusmod cillum. Id tempor irure culpa nisi sit non qui veniam non ut. Aliquip reprehenderit excepteur mollit quis excepteur ex sit. Quis do eu veniam do ullamco occaecat eu cupidatat nisi laborum tempor minim fugiat pariatur. Ex in nulla ex velit.\r\n",
"registered": "2019-04-08T03:54:36 -01:00",
"latitude": -70.660321,
"longitude": 71.547525,
"tags": [
"consequat",
"veniam",
"pariatur",
"aliqua",
"cillum",
"eu",
"officia"
],
"friends": [
{
"id": 0,
"name": "Test"
},
{
"id": 1,
"name": "Sample"
},
{
"id": 2,
"name": "Example"
}
],
"greeting": "Hello, Sample! You have 6 unread messages.",
"favoriteFruit": "apple"
}
]