I would like to add a new object.key to my JSON array.
To do that I have defined a new variable var result = {"bad":1} then I'm pushing
the items like this skippedData.push(item.metadata["pico:record"]["dc:description"],{result});
As JSON output I'm having:
[
{
"skippedData": [
{
"_": "Lungo le mura, al posto del baluardo nord-est, la cosiddetta Fortezza medicea è un degradato complesso di corpi di fabbrica eretti nella 2ª metà del '500 attorno al trecentesco cassero senese.",
"$": {
"xml:lang": "it"
}
},
{
"result": {
"bad": 1
}
}
]
}
]
Which is wrong since I'm having a new "result" object instead of a "result" object key.
My expected output should be:
[
{
"skippedData": [
{
"_": "Lungo le mura, al posto del baluardo nord-est, la cosiddetta Fortezza medicea è un degradato complesso di corpi di fabbrica eretti nella 2ª metà del '500 attorno al trecentesco cassero senese.",
"$": {
"xml:lang": "it"
},
"result": {
"bad": 1
}
}
]
}
]
What I'm doing wrong?
Regards