Currently I want to use the JSON data I fetched. My data looks like this:
{
"0": {
"date": "2018-12-06T20:49:02.489000",
"encoded": "B64Encoded",
"height": "390",
"name": "image2.jpg",
"width": "390"
},
"1": {
"date": "2018-12-06T20:49:02.489000",
"encoded": "B64Encoded",
"height": "136",
"name": "index.jpg",
"width": "371"
}
}
My problem lays in accessing the JSON Data. All then time, when I try
fetch('http://127.0.0.1:8888')
.then((response) => response.json())
.then((responseJson) => {
this.setState({
jsonData: responseJson[0].name
})
});
I end up with an undefined object. I believe the problem is in how the JSON is defined. How can I access it correctly?