# ParseJSON

Parse JSON offers the ability to flatten or explode JSON objects from one JSON column into new broken out columns in your dataset. You can also select the max level to flatten if you want to flatten to deeper levels in the JSON string.

<figure><img src="https://1817223046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5mI0ilekQtcGTXKGQ2EF%2Fuploads%2FVwJOzxNKoP20Oq7naOxs%2FDiagram.png?alt=media&#x26;token=0a28e7b1-2e0d-4f67-a2d3-2592936ab0cc" alt=""><figcaption></figcaption></figure>

Any JSON array can be parsed via explode or flatten.&#x20;

<table><thead><tr><th width="265">Option</th><th>Description</th></tr></thead><tbody><tr><td>Flatten</td><td>Flattening converts nested JSON objects into a flat structure</td></tr><tr><td>Explode</td><td>Exploding means creating separate rows for each object in the array</td></tr><tr><td>Max level to flatten</td><td>This setting is asking how many levels deep the tool should go to flatten nested JSON structures. JSON data can be nested, meaning objects can contain other objects or arrays. Flattening means converting this nested structure into a flat table-like structure.</td></tr></tbody></table>

{% hint style="info" %}
Note that when entering the number of levels to flatten, If left blank,  the tool will normalize all levels. If JSON cannot be flattened at the level selected, tool will return nothing.
{% endhint %}

### Example 1 (Flatten)

Let's say we have a table with a "Hierarchy" column that contains a JSON array:

{% embed url="<https://datawrapper.dwcdn.net/yq93I/2/>" %}

We can choose to flatten the "Hierarchy" column and it will get the following result with a new "Category" column:

{% embed url="<https://datawrapper.dwcdn.net/3FwdK/1/>" %}

### Example 2 (Explode)

Let's say we have a table with a "Size" column that contains a JSON array:

{% embed url="<https://datawrapper.dwcdn.net/KAlvb/1/>" %}

We can choose to explode the "Size" column and it will get the following result with a new "Size\_1" column:

{% embed url="<https://datawrapper.dwcdn.net/lg9Bq/1/>" %}
