0

I have below Json output

{ "IDsInThisList":"28184,28181,28180,28178","RowsReturned":"4","List" :[{"ContentID":28184,"ArticleType":"News","Headline":"Mobile Bytes","Article":"<p>HTC CFO Chialin Chang expects the manufacturer&rsquo;s fortunes to change for the better going in to 2014.</p>"}]}

I need to get "Headline" out and display it using jquery template, i normally uses {{:Headline}} but for somereason its not working, possibly because its inside "List", how to i render "Headline" out?

1
  • json not directly populate the html your have to use any javascript template engine: eg :JADE Commented Feb 10, 2014 at 17:45

1 Answer 1

3

Parse the string using JSON.parse() then access using a.List[0].Headline

var a=JSON.parse('{ "IDsInThisList":"28184,28181,28180,28178","RowsReturned":"4","List" :[{"ContentID":28184,"ArticleType":"News","Headline":"Mobile Bytes","Article":"<p>HTC CFO Chialin Chang expects the manufacturer&rsquo;s fortunes to change for the better going in to 2014.</p>"}]}');

console.log(a.List[0].Headline);

Fiddle Demo

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

2 Comments

But how to display using Jquery template?
what you mean by Jquery template?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.