Parsing json in kusto query

Viewed 24252

How can I extract individual values from a JSON using KUSTO query.

I want to be able to read the value for SourceSystemId, Message and project these values. I also want to use date in the following JSON as a filter. And project only those records where date greater than a date supplied as an external parameter.

{{
  "Status": 2,
  "SourceSystemId": "4",
  "RequisitionId": null,
  "Errors": [
    {
      "Code": "8002",
      "Message": "some message",
      "FieldName": "VendorNumber",
      "PartNumber": null
    },
    {
      "Code": "8003",
      "Message": "",
      "FieldName": "PartNumber",
      "PartNumber": ""
    }
  ],
  "SuppName": "SomeSupp",
 "Date":"22/2/2017"
}}
3 Answers

Try |extend Status = extractjson("$.",toString([column]))

Its is simple when you want to parse JSON that is in column and want to have where clause on JSON properties -

        tablename 
        | extend prop= parse_json(jsonColumn) 
        | where prop.description == 'My Description' 
        | sort by nameCoumn desc | take 1
Related