🛤
JSONPath Tester (Pick data từ JSON)
Test JSONPath query với JSON sample. Hỗ trợ recursive descent, slice, filter cơ bản. Phù hợp pick data từ API response, debug LLM structured output.
Kết quả
Cú pháp JSONPath
| $ | Root object |
| $.foo / $["foo"] | Property foo |
| $.foo.bar | Nested property |
| $[0] | Phần tử mảng đầu tiên |
| $[-1] | Phần tử cuối |
| $[*] | Tất cả phần tử |
| $[0:3] | Slice 0..2 |
| $..price | Recursive — mọi `price` ở mọi level |
| $.items[?(@.price > 100)] | Filter (subset support) |
Test JSONPath query với JSON sample. Implement JSONPath subset (RFC 9535 draft). Dùng để pick data từ API response, debug structured output LLM.
JSONPath là gì?
JSONPath = "XPath cho JSON". Cú pháp query để extract phần dữ liệu từ JSON object/array. Phổ biến trong:
- Postman: test API response — assert
$.data.users[0].id === 1. - jq (CLI): dùng pattern tương tự để query JSON từ command line.
- AWS CLI:
--query 'Reservations[*].Instances[*].PublicIpAddress'. - OpenSearch / Elasticsearch: query nested fields.
- LangChain / LLM: extract structured output từ LLM response.
Cú pháp tóm tắt
$— root.$.foohoặc$["foo"]— property.$[0]— index,$[-1]— last.$[*]— tất cả phần tử/property.$[0:3]— slice.$..price— recursive descent (mọipriceở mọi level).$.items[?(@.price > 100)]— filter.
Use case thực tế
// API response
{
"store": {
"books": [
{ "title": "AI for Everyone", "price": 350000 },
{ "title": "Sapiens", "price": 280000 }
]
}
}
// Lấy tất cả title:
$.store.books[*].title // ["AI for Everyone", "Sapiens"]
// Lấy book có giá > 300k:
$.store.books[?(@.price > 300000)]
// Recursive — mọi price trong document:
$..price // [350000, 280000] JSONPath vs JSON Pointer (RFC 6901)
- JSONPath: query language — flexible, có wildcard, filter.
- JSON Pointer (
/foo/0/bar): chỉ trỏ tới 1 location cụ thể, không có wildcard.
Liên quan
- Format JSON — clean trước query
- JSON Schema Generator
- JSON → TypeScript
- Regex Tester
- Xem tất cả công cụ
Công cụ liên quan
Xem tất cả công cụ →MỚI
🔐
JWT Decoder
Decode JWT token, xem header/payload/claims với thời gian dễ đọc.
MỚI🎨
Format JSON
Format / minify / validate JSON. Sort key A-Z, custom indent, phím tắt Ctrl+Enter.
MỚI🔍
Regex Tester
Test regex realtime với highlight match. 7 mẫu sẵn cho VN (email, SĐT, CCCD, IP...).
MỚI🔑
UUID / Hash / Base64 / URL
Bundle 4 dev tool: UUID v4, SHA-256/512 hash, Base64 (URL-safe), URL encode.