Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
maxLevel2
typeflat

Description

Returns the data type of the value inside a JSON object. Note that you must first extract the value from the JSON using the Jq evaluation (jqeval) operation. This operation is helpful when you want to convert the data type of the extracted value and you need to know which one is appropriate.

Alternatively, you can quickly check the data types and transform them even, without previously extracting them, using the pretty-print view (more info in the article Working with JSON objects in data tables).

How does it work in the search window?

Select Create column in the search window toolbar, then select the Json value type operation. You need to specify one argument:

Argument

Data type

Json to get the type mandatory

json

The data type of the values in the new column is string.

Example 1

In this example, in the demo.ecommerce.data table, we will perform the To json (jsonparse) operation to obtain the JSON below (1) and the Jq evaluation (jqeval) operation to extract one value from it (2):

...

Use the operator select... as...  and add the operation syntax to create the new column. This is the syntax for the Json value type operation:

  • label(json_value)

Example 1

You can use the following LINQ script to recreate example 1 in any table (for example, in demo.ecommerce.data):

Code Block
from demo.ecommerce.data
select jsonparse("{ \"name\":\"John\", \"birth\":\"1986-12-14\", \"city\":\"New York\"}") as Json
select jqeval(jqcompile(".city"), Json) as City
select label(City) as CityLabel

Example 2

You can use the following LINQ script to recreate example 2 in any table (for example, in demo.ecommerce.data):

...