Next.js Discord

Discord Forum

TypeError: Cannot read properties of undefined (reading 'map')

Answered
Giant panda posted this in #help-forum
Open in Discord
Giant pandaOP
.
Answered by aardani
const data = JSON.parse(inputJSON)
View full answer

26 Replies

Giant pandaOP
I haven't worked on my site for a long time. Previously, it worked perfectly with no issues. I even deployed it on Vercel, and it worked there as well. However, today it is causing errors
@Giant panda Click to see attachment
try console.log(inputJSON)?
@Ray try `console.log(inputJSON)`?
Giant pandaOP
@Giant panda Click to see attachment
what is GetAllPrograms()?
@Giant panda Click to see attachment
when is this console logged? where did you put the console log?
@aardani what is GetAllPrograms()?
Giant pandaOP
Sends a API Request and returns Response
@aardani when is this console logged? where did you put the console log?
Giant pandaOP
GetAllPrograms()
@Giant panda Click to see attachment
is this logged in the server or in the browser
@aardani is this logged in the server or in the browser
Giant pandaOP
browser
thats the response
can you do console.log("Hello") before console.log(inputJSON) and see if Hello is printed once or twice
@aardani can you do console.log("Hello") before console.log(inputJSON) and see if Hello is printed once or twice
Giant pandaOP
oh
inputJSON is still a string
you need to parse it first
const data = JSON.parse(inputJSON)
Answer
Giant pandaOP
yep thanks
finally
I cant thank you both enough :Chad:
you can thank us by marking which message helped you