In a React App, I have an array that want to convert it to JSON and send it to the server. I do it with this:
console.log(JSON.stringify(mainArray"))
And I want to test it and I expect something like this to see:
"breakfast": {
"1": "item 1",
"2": "item 2"
}
But I see only first item and a length item like this:
"breakfast": {
"1": "item 1",
"length": 2
}
Also when I log the array without JSON.Stringify, I see something like this:
What's that proto ? Why I dont see my whole data in a clean way? Also in this situation, Every thing works fine if I do this:
console.lo(breakfast[0]) //prints first item
console.lo(breakfast[1]) //prints second item
First I thought its console.log's display problem, But when I send it to the server I get the same. I have just a simple array and I want to see it regularly.
Aucun commentaire:
Enregistrer un commentaire