How Data Sources Store JSON and XML Data
TrueContext Data Sources Data sources, also known as "Lookups", are external sources of data that you upload or connect to TrueContext. You can reference this data in a form to populate answers or answer options. Data sources save typing, reduce errors, and make it easy to provide mobile users with only the relevant, most current data. support JSON and XML data. You can upload a JSON or XML file to Manual Upload Data Sources, and HTTP GET Data Sources can fetch JSON or XML data from third-party systems. This topic describes how Data Sources store JSON and XML Data. It also includes examples of JSON and XML structures that are supported and not supported.
Available on all tiers:
While TrueContext supports JSON and XML data on all tiers, HTTP GET Data Sources are only available to Advanced and Enterprise customers.
Contents
Supported JSON and XML structures
TrueContext Data Sources store JSON and XML data as a table.
Info:Make sure that your JSON or XML data stays within the Data Source size limits once converted to a table.
TrueContext supports:
TrueContext does not support:
Examples of how TrueContext stores JSON and XML data
Tip:Check the JSON or XML data that your third-party API endpoint returns. If you need the data in a different format for a TrueContext Data Source Data sources, also known as "Lookups", are external sources of data that you upload or connect to TrueContext. You can reference this data in a form to populate answers or answer options. Data sources save typing, reduce errors, and make it easy to provide mobile users with only the relevant, most current data., create a custom API endpoint. You can also check the third-party API endpoint for options to optimize the returned JSON or XML structure.
Supported formats
Array
Data | Data stored as a table | ||||
---|---|---|---|---|---|
JSON [1, 2, 3] |
|
||||
XML <root> <data>1</data> <data>2</data> <data>3</data> </root> |
Array of objects
Data | Data stored as a table | ||||||
---|---|---|---|---|---|---|---|
JSON [ { "id": "00001111", "description": "27\" Monitor" }, { "id": "00001112", "description": "Keyboard" } ] |
|
||||||
XML <data> <item> <id>00001111</id> <description>27" Monitor</description> </item> <item> <id>00001112</id> <description>Keyboard</description> </item> </data> |
Nested array of objects
Data | Data stored as a table | ||||||
---|---|---|---|---|---|---|---|
JSON { "results": [ { "id": "00001111", "description": "27\" Monitor" }, { "id": "00001112", "description": "Keyboard" } ] } |
|
||||||
XML <data> <results> <id>00001111</id> <description>27" Monitor</description> </results> <results> <id>00001112</id> <description>Keyboard</description> </results> </data> |
Nested array of objects with additional fields
Data | Data stored as a table | ||||||
---|---|---|---|---|---|---|---|
JSON { "numResults": 2, "numPages": 1, "results": [ { "invoiceNumber": "0001", "invoiceTotal": "323.32" }, { "invoiceNumber": "0002", "invoiceTotal": "117.33" } ] } |
|
||||||
XML <data> <numResults>2</numResults> <numPages>1</numPages> <results> <invoiceNumber>0001</invoiceNumber> <invoiceTotal>323.32</invoiceTotal> </results> <results> <invoiceNumber>0002</invoiceNumber> <invoiceTotal>117.33</invoiceTotal> </results> </data> |
Array of nested objects
Data | Data stored as a table | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
JSON [ { "name": "Jenna Martinez", "company": "Goldenmade Construction", "contact": { "email": "jmartinez@company.com", "phone": "3332221111", "address": { "street": "111 Goldenmade Street", "city": "Ottawa", "state": "Ontario", "zip": "K1A2B3", "country": "CA" } } }, { "name": "Jeremy Lau", "company": "Silver Mango Contractors", "contact": { "email": "jlau@email.com", "phone": "1112223333", "address": { "street": "222 Chicory Street", "city": "Ottawa", "state": "Ontario", "zip": "K2A2B3", "country": "CA" } } } ] |
|
|||||||||||||||||||||||||||
XML <data> <result> <name>Jenna Martinez</name> <company>Goldenmade Construction</company> <contact> <email>jmartinez@company.com</email> <phone>3332221111</phone> <address> <street>111 Goldenmade Street</street> <city>Ottawa</city> <state>Ontario</state> <zip>K1A2B3</zip> <country>CA</country> </address> </contact> </result> <result> <name>Jeremy Lau</name> <company>Silver Mango Contractors</company> <contact> <email>jlau@email.com</email> <phone>1112223333</phone> <address> <street>222 Chicory Street</street> <city>Ottawa</city> <state>Ontario</state> <zip>K2A2B3</zip> <country>CA</country> </address> </contact> </result> </data> |
Unsupported formats
Multiple root arrays
Data | Data stored as a table | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
JSON { "results1": [ { "invoiceNumber": "0001", "invoiceTotal": "323.32" }, { "invoiceNumber": "0002", "invoiceTotal": "117.33" } ], "results2": [ { "invoiceNumber": "0011", "invoiceTotal": "309.44" }, { "invoiceNumber": "0012", "invoiceTotal": "191.99" } ] } |
|
||||||||||||||||
XML <data> <results1> <invoiceNumber>0001</invoiceNumber> <invoiceTotal>323.32</invoiceTotal> </results1> <results1> <invoiceNumber>0002</invoiceNumber> <invoiceTotal>117.33</invoiceTotal> </results1> <results2> <invoiceNumber>0011</invoiceNumber> <invoiceTotal>309.44</invoiceTotal> </results2> <results2> <invoiceNumber>0012</invoiceNumber> <invoiceTotal>191.99</invoiceTotal> </results2> </data> |
Double-nested arrays
Data | Data stored as a table | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
JSON { "numResults": 2, "numPages": 1, "results": [ { "invoiceNumber": "0001", "invoiceTotal": "323.32", "parts": [ { "partId": "112211", "partQty": "5" }, { "partId": "332233", "partQty": "11" } ] }, { "invoiceNumber": "0002", "invoiceTotal": "117.33", "parts": [ { "partId": "887788", "partQty": "9" }, { "partId": "665566", "partQty": "7" }, { "partId": "114411", "partQty": "16" } ] } ] } |
|
||||||||||||||||||||||||
XML <data> <numResults>2</numResults> <numPages>1</numPages> <results> <invoiceNumber>0001</invoiceNumber> <invoiceTotal>323.32</invoiceTotal> <parts> <partId>112211</partId> <partQty>5</partQty> </parts> <parts> <partId>332233</partId> <partQty>11</partQty> </parts> </results> <results> <invoiceNumber>0002</invoiceNumber> <invoiceTotal>117.33</invoiceTotal> <parts> <partId>887788</partId> <partQty>9</partQty> </parts> <parts> <partId>665566</partId> <partQty>7</partQty> </parts> <parts> <partId>114411</partId> <partQty>16</partQty> </parts> </results> </data> |
Tip:Check the JSON or XML data that your third-party API endpoint returns. If you need the data in a different format for a TrueContext Data Source, create a custom API endpoint. You can also check the third-party API endpoint for options to optimize the returned JSON or XML structure.