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 ?

Imdad
6,0424 gold badges37 silver badges53 bronze badges
asked Aug 15, 2013 at 11:48
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.

answered Aug 15, 2013 at 11:52
Sign up to request clarification or add additional context in comments.

1 Comment

jepp thats what I expected.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.