Handlebars.js: Can you not use {{ }} around a json property with a space in it's name?

Created on 7 Nov 2012  路  1Comment  路  Source: handlebars-lang/handlebars.js

For instance:

{
    "Sql2005 orLower": false,
    "OutputPath": "C:\\"
}

If I try use the first property like this:

{{ Sql2005 orLower }}

It errors out, even though that's valid JSON and Javascript? I tried putting a single quote around it but it doesn't like it, what is the solution for this?

Most helpful comment

You need to use the literal reference syntax i.e. {{[foo bar]}} and {{[foo bar]/expression}} if you are trying to access {"foo bar": "baz"} or {"foo bar": {expression: "baz"}}

>All comments

You need to use the literal reference syntax i.e. {{[foo bar]}} and {{[foo bar]/expression}} if you are trying to access {"foo bar": "baz"} or {"foo bar": {expression: "baz"}}

Was this page helpful?
0 / 5 - 0 ratings