dust templates - how to render json field with whitespace in its name

36 views
Skip to first unread message

MC

unread,
Jun 13, 2014, 4:48:48 PM6/13/14
to nod...@googlegroups.com
Hello,
I have a json object which contains fields with whitespace in their names (e.g. { "My Name" : "Bob" } ).
I'm trying to render those using dust templates, like this:
<span>{'My Name'}</span>
However this does not render the field (whatever is enclosed in single quotes gets rendered).
I tried other approaches:
<span>{My Name}</span>
<span>{"My Name"}</span>
But those didn't work either.
I'd appreciate any help in this matter, I couldn't find any info online.
Thanks,

M

// ravi

unread,
Jun 13, 2014, 6:01:37 PM6/13/14
to nod...@googlegroups.com
On Jun 13, 2014, at 4:48 PM, MC <vide...@gmail.com> wrote:
Hello,
I have a json object which contains fields with whitespace in their names (e.g. { "My Name" : "Bob" } ).
I'm trying to render those using dust templates, like this:
<span>{'My Name'}</span>
However this does not render the field (whatever is enclosed in single quotes gets rendered).
I tried other approaches:
<span>{My Name}</span>
<span>{"My Name"}</span>
But those didn't work either.


I don’t know a thing about Dust, but does this help?


—ravi


MC

unread,
Jun 13, 2014, 7:35:27 PM6/13/14
to nod...@googlegroups.com
Yes this helps, thank you. It looks like Dust templates restrict fields which are valid according to json specification, but that's another story.
Thanks,

M

On Friday, June 13, 2014 3:01:37 PM UTC-7, // ravi wrote:
Reply all
Reply to author
Forward
0 new messages