What are the acceptable JSON formats?
What are the acceptable JSON formats?
Answer
When creating a new search collection for an app or store, you can import your data in a JSON format. Examples of acceptable JSON are mentioned below.
Nested JSON is not supported.
One record:
{
"id": "123",
"attrib":"value"
}
One record with list:
{
"id": "123",
"attrib":"value",
"list":["item1","item2","item3"]
}
Multiple records:
[
{
"id": "1",
"attrib":"value1"
},
{
"id": "2",
"attrib":"value2"
}
]
Multiple records with list:
[
{
"id":"1",
"attrib":"value",
"list":["item1","item2","item3"]
},
{
"id":"2",
"attrib":"value2",
"list":["item1"]
},
{
"id":"3",
"attrib":"value2",
"list":"item1"
}
]
Note that if a schema field is a list, a record can have a single value either with or without square brackets. Both formats are acceptable and will be indexed.