I'm having issues with space characters in JSON object names. GTL does not find the names in a JSON object if the name contains spaces.
I have a "Shipping Address"
JSON object that looks like this (which is in a content
Data Extension field):
"Shipping Address":{
"Shipping First Name":"Simon",
"Shipping Last Name":"Basic",
"Shipping Address 1":"12/12 Sunshine Road",
"Shipping Address 2":"",
"Shipping SuburbCity":"Sampletown",
"Shipping State":"VIC",
"Shipping Postcode":"1234",
"Shipping Country":"Australia"
}
Here's the code in my email:
%%[
VAR @content
SET @content = content
]%%
{{.datasource order type=variable source=@content}}
{{.data}}
{"target":"@content"}
{{/data}}
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
{{.datasource address type=nested}}
{{.data}}
{"target":"order.Shipping Address"}
{{/data}}
<td class="txt-16" style="font-family: Georgia, Arial, sans-serif; font-size: 12px; line-height: 20px; color: #777777;">{{Shipping First Name}} {{Shipping Last Name}}
<br>{{Shipping Address 1}} {{Shipping Address 2}} {{Shipping SuburbCity}}<br>
{{Shipping State}} {{Shipping Country}} {{Shipping Postcode}}</td>
{{/datasource}}
</tr>
</table>
When I preview the email, the mustache tags are not replaced with the data, they are just empty.
However, if I replace the spaces with another character, for example, "Shipping_Address"
, "Shipping_First_Name"
, etc then it works fine.
Space characters should be allowed, as this is valid JSON. Does anyone know a solution to this?