0

What is the difference between JSON and MULTIJSON data format? Isn't it all a JSON? When should we use one or the other? How should the payload look when using one or the other?

Garbem
  • 149
  • 1
  • 13

1 Answers1

1

please see: https://learn.microsoft.com/en-us/azure/data-explorer/ingest-json-formats?tabs=kusto-query-language#the-json-format

Azure Data Explorer supports two JSON file formats:

json: Line separated JSON. Each line in the input data has exactly one JSON record.

multijson: Multi-lined JSON. The parser ignores the line separators and reads a record from the previous position to the end of a valid JSON.

and: https://learn.microsoft.com/en-us/azure/data-explorer/ingestion-supported-formats

JSON: A text file with JSON objects delimited by \n or \r\n. See JSON Lines (JSONL).

MultiJSON: A text file with a JSON array of property bags (each representing a record), or any number of property bags delimited by whitespace, \n or \r\n. Each property bag can be spread on multiple lines. This format is preferred over JSON, unless the data is non-property bags.

you should choose according to how your source data is formatted. if in doubt, choose multijson, as it 'contains' json.

example for json with 2 records:

{"Hello":"World"}
{"Foo":{"Bar":"x"}}

example for multijson with 2 records:

{
   "Hello": "World"
}
{   
    "Foo": {
       "Bar": "x"
    }
}
Yoni L.
  • 22,627
  • 2
  • 29
  • 48
  • I would like to know more about this. Why are objects separated by System.newline instead of commas like an usual JSON? { o1, o2 }. Why is there a limitation or if you forgot to mention having a payload like: [ {}, {}, {} ] which is also a valid JSON. – Garbem Jan 08 '21 at 15:24
  • the payload you included in your comment is covered by the `multijson` format. as i've mentioned in my answer: *"if in doubt, choose `multijson`, as it 'contains' `json`."* – Yoni L. Jan 08 '21 at 15:57