跳转到主要内容
CuteJSON
↑↓ 导航 Enter 选择 Esc 关闭

Query Workbench

Write a JSONPath or JMESPath query, pick the language you meant, and see exactly what it computes.

返回所有工具

键盘快捷键

这些快捷键在页面上对应操作存在时有效。

打开命令面板
Ctrl/Cmd + K
运行主要操作
Ctrl/Cmd + Enter
格式化
Ctrl/Cmd + Shift + F
压缩
Ctrl/Cmd + Shift + M
复制输出
Ctrl/Cmd + Shift + C
打开文件
Ctrl/Cmd + Shift + O
下载输出
Ctrl/Cmd + S
关闭此对话框
Esc
打开此对话框
F1 / ?

本地数据

以下所有内容仅存储在此浏览器、此设备上。

未保存的草稿
记住选项的工具

最近打开的文件

    此设备上尚未打开任何文件。

    通过链接分享

    内容被打包在链接 # 号之后的部分。

    分享此页面上的第一个输入。

    暂无可分享的内容。

    示例

    输入

    从 URL 加载

    直接从浏览器获取 URL。

    Result

    结果将显示在此处。

    完全在您的浏览器中运行。

    关于此工具

    JSONPath and JMESPath answer different questions, so this tool never guesses which one a query is written in, the switch above the query box picks the language. JSONPath finds locations inside a document: every match keeps the shape it already had. JMESPath computes a new value instead: a pipe, a multi-select or a function call can reshape the data into something the document never literally contained, a list of just the fields you asked for, a single number, a document sorted by a field that only appears buried three levels down. This page implements the whole JMESPath 1.0 language, including every function in its standard library, listed below. It does not implement JSONata or jq-style expressions, both of which are their own considerably larger languages, and says so rather than quietly falling back to something else. The JSONPath mode reuses the same engine as the dedicated JSONPath Tester on this site; reach for that tool instead when you want to click a match and see it highlighted inside your document, since this page always prints a computed result rather than a browsable list of locations.

    使用方法

    1. Paste your JSON into the editor, or load the sample.
    2. Choose JSONPath or JMESPath, then write a query or press one of the examples.
    3. Read the result on the right. A JMESPath query computes a new value; a JSONPath query lists every match.

    JMESPath functions

    The whole standard library, the same 25 functions the specification defines.

    abs(number) Absolute value.
    avg(array) Average of the numbers, null if empty.
    ceil(number) Rounds up.
    contains(subject, value) True if the string or array contains it.
    ends_with(string, suffix) True if the string ends with it.
    floor(number) Rounds down.
    join(glue, array) Joins strings with a separator.
    keys(object) The object's own keys.
    length(value) Character, element or key count.
    map(&expr, array) Applies an expression to every element.
    max(array) The largest value, null if empty.
    max_by(array, &expr) The element with the largest computed value.
    merge(object, ...) Shallow merges objects, left to right.
    min(array) The smallest value, null if empty.
    min_by(array, &expr) The element with the smallest computed value.
    not_null(value, ...) The first argument that is not null.
    reverse(value) Reverses a string or an array.
    sort(array) Sorts numbers or strings, ascending.
    sort_by(array, &expr) Sorts by a computed value, stably.
    starts_with(string, prefix) True if the string starts with it.
    sum(array) Adds up the numbers.
    to_array(value) 将非数组值包装为数组,数组保持不变。
    to_string(value) The value as a string.
    to_number(value) 将值转换为数字,如果无法转换则返回 null。
    type(value) The JMESPath type name.
    values(object) The object's own values.

    Need the full JSONPath syntax table, or want to click a match to see it highlighted in your document? Use the dedicated JSONPath Tester instead.