You should first know exactly what the "JSON" format is ...
value: "1",
should be written as "value": "1",
JSON is a format, does not exist ;
what you wrote is array
, so it should be embedded in []
or [ { "value":"1","descricao":"2"}, ... ]
use an Online Parser to see if the syntax is correct, eg link
The correct text in your file should be written as:
[
{
"value": "1",
"descricao": "1"
},
{
"value": "2",
"descricao": "2"
},
{
"value": "3",
"descricao": "3"
}
]
Just to add a bit more information about the format, the variables have to be delimited by double quote "
, only the values is not ...
"value": "3"
causes value
to have the value of a string with content 3
"value": 3
causes value
to have the value of a number with content 3
, that is, in the case of its example, and imagining that the object has the variable data
:
the result of data[0].value + data[1].value
will be 12
and not 3