1

I have an object like that

[{"created_at":"Thu Aug 15 11:45:05 +0000 2013","id":367975226434670592,"id_str":"367975226434670592","text":"What makes @asana the 'Tesla of productivity tools': http:\/\/t.co\/TFzHFEpXqJ"}]

And I am interested only in 'text' part in this object.

I tried

var obj = JSON.parse(data);
console.log( obj.text );

but It didn't work, help ?

3
  • What does console.log( obj ); show you? Commented Aug 15, 2013 at 11:50
  • @Harry console.log( obj.text ) shows me undefined Commented Aug 15, 2013 at 11:50
  • Ok, thats like expected, but what does console.log( obj ); show you? Commented Aug 15, 2013 at 11:52

1 Answer 1

4

You are parsing an array containing your object as its only element. Try obj[0].text.

Sign up to request clarification or add additional context in comments.

1 Comment

jepp thats what I expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.