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.
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.
Phù hợp với ai
Lập trình viên fullstack/backend/devops — debug JWT, format JSON/SQL, parse cURL, tính subnet CIDR, vẽ diagram Mermaid, viết commit chuẩn… Toolkit dùng hằng ngày trong terminal & code editor.
Câu hỏi thường gặp
Code/token tôi paste có gửi đi đâu không?
Không. Tất cả công cụ dev của TopDev chạy 100% client-side — JWT, SQL, JSON, cURL, regex… đều xử lý trong trình duyệt. Bạn có thể tắt mạng để kiểm chứng. Phù hợp để paste token nội bộ, query database production, key API.
Có hỗ trợ offline / cài thành PWA không?
Tool đã chạy được offline sau lần load đầu tiên. PWA installable đang nằm trong roadmap — hiện tại bạn có thể bookmark trang và dùng khi mất mạng.
Công cụ liên quan
Xem tất cả công cụ →JWT Decoder
Decode JWT token, xem header/payload/claims với thời gian dễ đọc.
MỚISo sánh văn bản (Diff)
Paste 2 đoạn text/code → highlight khác biệt từng từ/dòng/ký tự. Phù hợp diff output AI.
MỚIJSON Schema Generator
Tạo JSON Schema (Draft-07) từ JSON mẫu — dùng cho structured output LLM, validate API.
MỚIFormat JSON
Format / minify / validate JSON. Sort key A-Z, custom indent, phím tắt Ctrl+Enter.