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"
}
CODE

One record with list:

{
  "id": "123",
  "attrib":"value",
  "list":["item1","item2","item3"]
}
CODE

Multiple records:

[
  {
  "id": "1",
  "attrib":"value1"
  },
  {
  "id": "2",
  "attrib":"value2"
  }
]
CODE

Multiple records with list:

[
  {
    "id":"1",
    "attrib":"value",
    "list":["item1","item2","item3"]
  },
  {
    "id":"2", 
    "attrib":"value2", 
    "list":["item1"]
  },
  {
    "id":"3",
    "attrib":"value2",
    "list":"item1"
  }
]
CODE

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.