# parse\_json

Parses a JSON string into a Liquid object. Useful when working with API responses, stored data, or metafield values that are JSON-encoded strings.

```liquid
{% assign data = '{"name": "John", "age": 30}' | parse_json %}
{% log data.name %}
```

Output:

```
John
```

#### Syntax

```liquid
{{ json_string | parse_json }}
```

| Parameter     | Description                  |
| ------------- | ---------------------------- |
| `json_string` | A valid JSON string to parse |

#### Return Value

Returns a Liquid object (hash, array, string, number, or boolean) depending on the JSON content.

#### Examples

**Parse a JSON string:**

```liquid
{% assign product_data = '{"title": "T-Shirt", "price": 29.99}' | parse_json %}
{% log product_data.title %}
{% log product_data.price %}
```

**Parse a metafield value:**

```liquid
{% assign config = product.metafields.custom.settings.value | parse_json %}
{% log config.color %}
```

**Parse an API response body:**

```liquid
{% assign response_data = http_result.body | parse_json %}
{% for item in response_data.results %}
  {% log item.name %}
{% endfor %}
```

**Parse stored JSON from file storage:**

```liquid
{% storage_read filename:"config.json" as file_content %}
{% assign config = file_content | parse_json %}
{% log config.api_key %}
```

**Parse a JSON array:**

```liquid
{% assign items = '[1, 2, 3, 4, 5]' | parse_json %}
{% for item in items %}
  {% log item %}
{% endfor %}
```

#### Notes

* Throws an error if the input is not valid JSON
* For building JSON objects, use the `{% json %}` tag instead
* See also: `parse_csv`, `parse_xml`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datajet-app.com/liquid/filters/parse.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
