I’m trying to print out “message”
JSON:
[{"outcome":false,"message":"This is the message"}]
I’ve tried 3 things, here are the outcomes of them…
console.log(msg) => [{"outcome":false,"message":"Your account is pending beta activation"}] (this is fine)
var x = $.parseJSON(msg);
console.log(x) gives me an object
console.log(x.message) gives me undefined
What’s the correct way to access msg.message, if not like that?
You have an Object in an Array. Use index
0.If you’re anticipating more Objects in the Array, you can use
$.eachto iterate the Array.