Skip to main content

[en] JSON Parse tool JSON Parse Tool

[en] One Tool Example

[en] JSON Parse has a One Tool Example. Visit Sample Workflows to learn how to access this and many other examples directly in Alteryx Designer.

[en] Use JSON Parse to separate JavaScript Object Notation (JSON) text into a table schema for the purpose of downstream processing. It can be built back up into usable JSON format by feeding the output into the JSON Build tool.

[en] Configure the Tool

[en] JSON Field: Select the fields that hold JavaScript Object Notation (JSON) text. The field must contain valid JSON with all the text for a record in a single cell. Refer to this example:

   {
        "firstName": "John",
        "lastName": "Smith",
        "age": 25,
        "address": {
                "streetAddress": "21 2nd Street",
                "city": "New York",
                "state": "NY",
                "postalCode": "10021"
},
"phoneNumber": [
        {
                "type": "home",
                "number": "212 555-1234"
        },
        {
                "type": "fax",
                "number": "646 555-4567"
        }
    ]
}

[en] Include in Output: The selected column is included in the data stream coming out of the tool.

[en] Choose how the JSON gets parsed. Choices include:

[en] Output values to a single field: Two fields are output, JSON Name and JSON_ValueString. Looking at the input example above, the following data comes out of the tool:

[en] JSON_Name

[en] JSON_ValueString

[en] firstName

[en] John

[en] lastName

[en] Smith

[en] age

25

[en] address.streetAddress

[en] 21 2nd Street

[en] address.city

[en] New York

[en] address.state

[en] NY

[en] address.postalCode

10021

[en] phoneNumber.0.type

[en] home

[en] phoneNumber.0.number

212-555-1234

[en] phoneNumber.1.type

[en] fax

[en] phoneNumber.1.number

646-555-4567

[en] Output values into data type specific fields: Five fields are output.

[en] Field Name

[en] Description

[en] JSON_Name

[en] The JSON_Name is the 'key' of a JSON Object (key:value pair). A dot separates the key and any hierarchical categories.

[en] JSON_Value String

[en] The corresponding string 'value' of the JSON Object (key:value pair). If the value is not a string, it will display as [Null].

[en] JSON_ValueInt

[en] The corresponding integer 'value' of the JSON Object (key:value pair). If the value is not an integer, it will display as [Null].

[en] JSON_ValueFloat

[en] The corresponding float 'value' of the JSON Object (key:value pair). If the value is not a float, it will display as [Null].

[en] JSON_ValueBool

[en] The corresponding bool 'value' of the JSON Object (key:value pair). If the value is not a bool, it will display as [Null].

[en] Example Output

[en] JSON_Name

[en] JSON_ValueString

[en] JSON_ValueInt

[en] JSON_ValueFloat

[en] JSON_ValueBool

[en] firstName

[en] John

[en] [Null]

[en] [Null]

[en] [Null]

[en] lastName

[en] Smith

[en] [Null]

[en] [Null]

[en] [Null]

[en] age

[en] [Null]

25

[en] [Null]

[en] [Null]

[en] address.streetAddress

[en] 21 2nd Street

[en] [Null]

[en] [Null]

[en] [Null]

[en] address.city

[en] New York

[en] [Null]

[en] [Null]

[en] [Null]

[en] address.state

[en] NY

[en] [Null]

[en] [Null]

[en] [Null]

[en] address.postalCode

10021

[en] [Null]

[en] [Null]

[en] [Null]

[en] phoneNumber.0.type

[en] home

[en] [Null]

[en] [Null]

[en] [Null]

[en] phoneNumber.0.number

212-555-1234

[en] [Null]

[en] [Null]

[en] [Null]

[en] phoneNumber.1.type

[en] fax

[en] [Null]

[en] [Null]

[en] [Null]

[en] phoneNumber.1.number

646-555-4567

[en] [Null]

[en] [Null]

[en] [Null]