How Data Sources Store JSON 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 data. You can upload a JSON file to Manual Upload Data Sources, and HTTP GET Data Sources can fetch JSON data from third-party systems. This topic describes how Data Sources store JSON Data. It also includes examples of JSON structures that are supported and not supported.
Contents
Supported JSON structures
TrueContext Data Sources store JSON data as a table.
Info:Make sure that your JSON 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 data
Tip:Check the JSON 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 structure.
Supported formats
Array
- Fetched data
-
Copy
[001, 002, 003]
-
Data stored as a table
-
Data 001 002 003
Array of objects
- Fetched data
-
Copy
[{
"id": "00001111",
"description": "27\" Monitor"
},
{
"id": "00001112",
"description": "Keyboard"
}
] -
Data stored as a table
-
id description 00001111 27" Monitor 00001112 Keyboard
Nested array of objects
- Fetched data
-
Copy
{
"results": [{
"id": "00001111",
"description": "27\" Monitor"
},
{
"id": "00001112",
"description": "Keyboard"
}
]
} -
Data stored as a table
-
id description 00001111 27" Monitor 00001112 Keyboard
Nested array of objects with additional fields
- Fetched data
-
Copy
{
"numResults": 2,
"numPages": 1,
"results": [{
"invoiceNumber": "0001",
"invoiceTotal": "323.32"
},
{
"invoiceNumber": "0002",
"invoiceTotal": "117.33"
}
]
} - Data stored as a table
-
invoiceNumber invoiceTotal 0001 323.32 0002 117.33
Array of nested objects
- Fetched data
-
Copy
[{
"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"
}
}
}
] -
Data stored as a table
-
name company contact / email contact / phone contact / address / street contact / address / city contact / address / state contact / address / zip contact / address / country Jenna Martinez Goldenmade Construction jmartinez@company.com 3332221111 111 Goldenmade Street Ottawa Ontario K1A2B3 CA Jeremy Lau Silver Mango Contractors jlau@email.com 1112223333 222 Chicory Street Ottawa Ontario K2A2B3 CA
Unsupported formats
Multiple root arrays
- Fetched data
-
Copy
{
"results1": [{
"invoiceNumber": "0001",
"invoiceTotal": "323.32"
},
{
"invoiceNumber": "0002",
"invoiceTotal": "117.33"
}
],
"results2": [{
"invoiceNumber": "0011",
"invoiceTotal": "309.44"
},
{
"invoiceNumber": "0012",
"invoiceTotal": "191.99"
}
]
} - Data stored as a table
-
results1 (1) / invoiceNumber results1 (1) / invoiceTotal results1 (2) / invoiceNumber results1 (2) / invoiceTotal results2 (1) / invoiceNumber results2 (1) / invoiceTotal results2 (1) / invoiceNumber results2 (1) / invoiceTotal 0001 323.32 0002 117.33 0011 309.44 0012 191.99
Double-nested arrays
- Fetched data
-
Copy
{
"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"
}
]
}
]
} - Data stored as a table
-
invoiceNumber invoiceTotal parts (1) / partId parts (1) / partQty parts (2) / partId parts (2) / partQty parts (3) / partId parts (3) / partQty 0001 323.32 112211 5 332233 11 0002 117.33 887788 9 665566 7 114411 16
Tip:Check the JSON 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 structure.