JSONPath 测试
对 JSON 数据测试 JSONPath 表达式
JSON Data
Results
Pull exactly what you need out of huge payloads
When a JSON document is hundreds or thousands of lines, scrolling to find a value isn't a strategy. JSONPath gives you an XPath-style query language for JSON: dot paths, array indexes, recursive descent, and filter expressions you can iterate on live until the result matches what you need.
Use the tester when you need to
Extract specific values from a response
Run expressions like $.users[?(@.active==true)].email to select exactly the fields that matter.
Debug a JSONPath query before shipping
Iterate on the expression in the browser until the matches look right, then paste it into your code.
Audit large or deeply nested documents
Use $..key to find every occurrence of a field anywhere in the tree, no matter how deep.
How to test a JSONPath expression
- 1
Paste your JSON data into the editor.
- 2
Type a JSONPath expression in the query field.
- 3
Review the matches and refine the expression until the result is exactly what you need.
Keep going
Browse the source visually
Use tree view to find candidate paths before writing JSONPath expressions.
Format the JSON first
Beautify the source so reading paths off the document is easier.
Validate the source
Make sure the document is valid before running queries against it.
JSONPath cheatsheet
Quick reference for filters, slices, and recursive descent.
Common JSONPath workflows
Recreate the query against a real response and tweak it until the matches are correct.
Find all values matching a condition deep in a payload and decide whether to alert or page.
Avoid loading the whole document into your app — extract only what you need at the boundary.
相关工具
常见问题
JSONPath 是 JSON 的查询语言,类似 XML 的 XPath。你可以用表达式从 JSON 文档中选择/提取特定值,比如 $.store.book[0].title,或 $..price(任意深度的所有 price)。
$ 表示根节点,.key 选子属性,[0] 选数组下标,[*] 选全部元素,.. 递归匹配任意深度,[?(@.price < 10)] 按条件过滤。例如:$.users[?(@.active==true)].name 会取出 active 为 true 的用户姓名。
把 JSON 数据粘贴到编辑器,在查询框输入 JSONPath 表达式,然后点击 Execute。匹配结果会立即显示,并同时给出命中的值和它在文档中的完整路径。
JSONPath 用点号风格($.store.book[0]),jq 用管道语法(.store.book[0] | ...)。JSONPath 更常见于 JavaScript/Java 生态;jq 是命令行工具,在 shell 脚本里很流行。两者都用于查询 JSON。