JSON Transform Playground (jq, JSONata, JMESPath)

Paste a JSON payload, write a jq, JMESPath or JSONata query and watch the result update as you type, then save the query as a snippet.

يعمل في متصفحك. ملفاتك لا تغادر جهازك أبدًا. شاهد كيف تتحقق

…

كيف تفعل ذلك

  1. 1
    Choose a language

    Press jq, JMESPath or JSONata at the top; for JSONata press Load JSONata once.

  2. 2
    Add data

    Pick a sample payload, open a .json or .ndjson file, or paste JSON into the Input box and press Format.

  3. 3
    Write the query

    Type in the query box or press one of the example buttons, such as Filter or Group, to start from a working query.

  4. 4
    Read the output

    The Output panel updates as you type; errors explain what went wrong. For jq set Raw strings and Compact as needed.

  5. 5
    Export

    Press Copy or Output to download the result, or CSV when the result is a list of objects.

  6. 6
    Save a snippet

    Name the query and press Save; reuse it later with Use or export all snippets.

عن هذه الأداة

Webhooks, REST APIs, log pipelines and cloud command line tools all hand you JSON, and most of the time you need only a slice of it: the commit messages in a push event, the card country in a payment, the SKUs and quantities of an order. Three small query languages dominate that job. jq is the command line favourite for shell scripts and CI jobs, JMESPath is what the AWS CLI and Azure CLI use in their query options and what many SDKs embed, and JSONata powers integration platforms and low-code automation tools. This playground lets you write any of the three against your own data and see the answer as you type, without installing anything. The jq and JMESPath engines were written for this page and run instantly in your browser. JSONata uses the official open source jsonata library, version 2.1.0, which your browser downloads once from the jsDelivr CDN when you press Load JSONata. Your JSON is never sent anywhere in any of the three modes.

jq on this page

The jq interpreter covers the language people actually use: dot paths, array iteration and slices, the optional operator, pipes, commas, object and array construction, string interpolation, arithmetic and comparison, and, or, the alternative operator, if then elif else, reduce and foreach, try and catch, variables with as, and update assignment with the pipe-equals operator. Built-ins include select, map, map_values, keys, has, length, add, any, all, sort_by, group_by, unique_by, min_by, max_by, to_entries, from_entries, with_entries, split, join, test, match, capture, sub, gsub, paths, getpath, setpath, del, flatten, range, limit, tostring, tonumber, tojson, fromjson, todate and the formats csv, tsv, json, text, html, uri, base64 and sh. The raw and compact switches behave like the minus r and minus c flags. User-defined functions with def, destructuring patterns, input and inputs, SQL-style built-ins and streaming mode are not supported; the error message says so when you use them.

JMESPath on this page

The JMESPath engine follows the published specification: identifiers, sub-expressions, index and slice, list and object projections, flatten, filter expressions, multi-select lists and hashes, pipes, or, and, not, literals in backticks, raw strings in single quotes and expression references with the ampersand. All standard functions are available, from abs, avg and contains to sort_by, max_by, merge, to_number and type.

Samples and snippets

Four invented sample payloads are included: a git push webhook, a payment event, a shop order and a chat message event, so you can try an idea before you have real data. Open a JSON file or a newline-delimited log file; with the NDJSON switch each line becomes one element of an array. Queries you want to keep are saved as named snippets in this browser, and the whole list can be exported and imported as a JSON file to share with colleagues.

Limits

The built-in jq is a reimplementation, not the jq binary, so rare edge cases such as number precision beyond double floats or exotic regular expression flags may differ; test critical filters with real jq before you ship them. JSONata needs a one-time download and does not work offline until it is cached. Very large inputs of tens of megabytes may make typing sluggish because every keystroke re-runs the query.

مثال محلول

Load the Git push sample, which has 3 commits. In jq, .commits | length returns 3. The filter .commits[] | select(.author.name == "Lee") | .message returns the two messages by Lee. In JMESPath, commits[*].message returns all three as a list, and length(commits[?author.name=='Ann']) returns 1. With the jq preset Group, the output lists Lee with 2 commits and Ann with 1, and because the result is an array of objects the CSV button appears and produces a two-column file.

حقائق سريعة

الأسئلة الشائعة

Is my JSON uploaded?

No. jq and JMESPath run entirely on this page. For JSONata only the library code is downloaded from jsDelivr; your data stays in the tab.

Is this the real jq?

It is an interpreter written in JavaScript that follows the jq manual for the common language. Results match jq for normal filters; a few advanced features listed on the page are not included.

Why does JMESPath return null instead of an error?

That is how the specification works: a missing key or a projection over something that is not a list yields null rather than failing.

Can I use this to test AWS CLI query options?

Yes. Paste the JSON the command returns without the query, then build the JMESPath expression here and copy it into your command.

How do I get CSV out?

Make the query return a list of objects; the CSV button then writes one column per key. In jq you can also emit rows with the csv format and the raw switch.

Where are my snippets stored?

In this browser's local storage. Use All snippets to download them and Import snippets on another computer.

مجاني تمامًابلا تكلفة وبلا تسجيل
ملفات خاصةكل شيء يعمل في متصفحك
سهل بلغتكمتوفر بلغات كثيرة