Document toolboxDocument toolbox

Autoparse a JSON object

Ā 

Parsing options

The autoparser is able to detect JSON objects in unparsed events and extract individual key/value pairs in different columns if needed.

To do it, access the unparsed my.app / my.upload table that contains the JSON objects and define the autoparser by following the steps inĀ Autoparser. The value in the Type column will be automatically set to JSON object for the detected JSON objects.Ā Click the dropdown selector to choose one of the available types:

  • JSON object - This is the default option, and transforms each JSON object into a jsonĀ type value.

  • JSON split - Split the JSON object into different values, indicating the required depth level. The values in the list correspond to the available depth levels in the JSON objects. Learn more about this in the section below.

  • String - This option transforms each JSON object into a string type value.

Split JSON objects

Choose the JSON split option in the Type column to divide your JSON object into different values. Once the option is selected, a second dropdown box appears to indicate the required depth level you want to apply.

After applying the autoparser, you will always get a column that shows the whole JSON objects (in json data type), whose name is the one you give in the Name field during the autoparsing creation process. Then, you will get as many additional columns as distinct keys you have in all your JSON objects, according to the given depth level. Not available levels in a specific JSON will be assigned null values. Learn more in the example below.

The order of the columns including the different JSON levels is random and may not follow the order of the JSON object.

Example

{ "splitInt":1, "childObj": { "childKey":"childVal", "childKey2":"childVal2", "childKey3":"childVal3", "childkey4": { "newlevel1":1, "newlevel2":2 } } }

Ā 

{ "S1": { "S2": { "S2_child": { "int1": 4, "int2": 5 } } } }

Ā 

We sent two events to Devo, each of them containing one of the JSON objects above. In the autoparser configuration, we named the JSON object myJSON, and set the Type to JSON split.Ā 

Let's see what happens when we select different depth levels:

Ā