I have the following JSON Object:
[{"id":"123","username":"test"}]
I want to parse username
using javascript so i did this
var content = '[{"id":"123","username":"test"}]
obj = JSON.parse(content)
alert(obj.username)
I get an alert: undefined
I've tried parsing the JSON without the [ ]
and it worked
For example:
var content = '{"id":"123","username":"test"}'
obj = JSON.parse(content)
alert(obj.username)
My question would be how would i parse the JSON with the [ ] tags around it? Thank you!