Naming variables

Your payload keys should never contain any dot or space and should never be only a number.

JSON
{
  // Valid keys
  "someVariable": "Some value",            // {{someVariable}}
  "some_variable": "Some value",           // {{some_variable}}
  "some-variable": "Some value",           // {{some-variable}}
  "SomeVariable": "Some value",            // {{SomeVariable}}
  "somevariable": "Some value",            // {{somevariable}}
  "some": { "variable": "Some value" },    // {{some.variable}}
  "2words": "Hello world",                 // {{2words}}
  
  // Invalid keys
  "some.variable": "Some value",
  "some variable": "Some value",
  "(someVariable)": "Some value",
  "'someVariable'": "Some value",
  "{{someVariable}}": "Some value",
  "2": "Some value",
  "$someVariable": "Some value"
}

Here is how you would call the valid keys in a template:

HTML
{{someVariable}}
{{some_variable}}
{{some-variable}}
{{SomeVariable}}
{{somevariable}}
{{some}}
{{2words}}

Last updated