Merge JSON data into an HTML ViewBox Template
Description
Merging JSON data with the HTML ViewBox Template.
For more information on this topic, read the guide below or watch this video.
Define the JSON Data
In the UX Builder on the UX Controls page open the 'Data Controls'. Select the [ViewBox] option to add a ViewBox control to the component.
In the properties list click on the button next to the ViewBox properties property, in the ViewBox Properties section.
Open the Data Source Pane. Set the ViewBox type control to 'Data' in the 'ViewBox Datasource' section.
In the ViewBox Data section set the Datasource type to be 'Static JSON'
In the 'Static JSON Data' dialog add the following JSON and click OK:
{ "name": "Fred", "city": "Boston" }
Creating the Template
Open the ViewBox Layout pane. Select the 'Genie' option and click the 'Add item' button.
In the Category list select 'Data Controls' and in the 'Control' list select [Label]. On the right, highlight the two fields for 'name' and 'city' and click OK.
Click OK to close the ViewBox Builder and run the component in Live Preview. You should see the JSON data displayed.
Modify the Template's HTML
On the Design tab's UX Controls page highlight the ViewBox control. Click on the ViewBox properties property to open the ViewBox Builder again.
Open the ViewBox Layout pane and select the 'Freeform editor' choice.
The Freeform editor should contain the placeholders for the two fields you defined in JSON. This example used the Genie to add these placeholders to the template but it would have been just as easy to type them into the Freeform template by hand.
Add some HTML around the placeholders Click OK to close the ViewBox.
Run the component in Live Preview.