1

This super simple test is giving me difficulty if I plug in the following extremely simple JSON and template. How do I access "s.name"?

Template:

<p>{{s.name}}</p>

JSON:

{s:{name:"S"}}

I also tried this template - still won't work:

<p>
{{#s}}
  {{name}}
{{/s}}
</p>

Am I missing something? How can I access s.name of the JSON?

2
  • Doesn't just {{name}} work.. Used it a long time ago. Commented Nov 11, 2012 at 3:31
  • @Sajit - No... That won't work Commented Nov 11, 2012 at 4:13

1 Answer 1

1

Your JSON is not valid because the keys are not strings. With valid JSON, either of your solutions work as demonstrated on jsFiddle.

{"s":{"name":"S"}}

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

1 Comment

Interesting...I came to the conclusion it doesn't work even after trying "strings" for JSON because it isn't working on the demo site for mustache at - mustache.github.com/#demo

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.