After making a request to my Django server for data, I utilized JSON.parse to convert the data into a JSON object. My goal is to iterate through each attribute of the object's field and execute the function createDiv
on each one.
function load_blog(){
let start_blog = 0
let end_blog = 4
fetch(`/blog/?start=${start_blog}&end_blog=${end_blog}`)
.then(response => response.json())
.then(json_blogs => {
var jsblog = JSON.parse(json_blogs)
jsblog.fields.forEach()
})
}
This is how the data appears after using JSON.parse https://i.sstatic.net/9bExW.png
I intend to apply the function to each dictionary under field
. However, I encountered this error:
jsblog.fields is undefined
Even though I can see fields in the console. Can anyone offer assistance?