...
So, when comparing JSON containing a list, to a list fetched from the data base, an inconsistent delta is generated because logically the JSON list supplied as input by the user is compared to the first JSON object of the same name, returned by the code. This comparison can be imagined as follows:
Expand |
---|
title | Visual comparison of data when JSON list is provided by user and compared to JSON list fetched from database |
---|
|
JSON provided by user | JSON fetched from database |
---|
Expand |
---|
| Code Block |
---|
{
"books": [
{
"title": "Book 1",
"lang": "N/A",
"price": 11,
"editions": [2009]
},
{
"title": "Book 2",
"lang": "German",
"price": 39,
"editions": [2007, 2013, 2021]
}
]
} |
|
| Expand |
---|
| Code Block |
---|
[
{
"books": {
"title": "Book 1",
"lang": "N/A",
"price": 11,
"editions": [2009]
}
},
{
"books": {
"title": "Book 2",
"lang": "German",
"price": 39,
"editions": [2007, 2013, 2021]
}
}
] |
|
|
|
Proposed Solution