Reputation: 1329
I am new at working with JSON objects and I have been trying to find an answer on here but the common method I have seen being used is not working for me.
I am trying to get the value 21 from the JSON object I can inspect in my javascript console.
^Object { number: Object }
^number: Object
min: 21
>_proto_: Object
The name of the JSON object is answer
so I tried to use JSON.parse
obj = JSON.parse(answer);
console.log(answer.min);
Or this
obj = JSON.parse(answer);
console.log(answer.number.min);
I know I'm missing something simple but I'm a visual learner and the docs don't do much for me.
Upvotes: 0
Views: 93
Reputation: 8446
I saw the comment fields from another post, and if answer really is just an object, then the following should work.
obj = answer.number.min
Upvotes: 1
Reputation: 190945
I'm guessing you need obj.number.min
, provided answer
is a string.
Upvotes: 0