/ 工具
■/ 工具搜尋
109 款工具
/ JSON Path 查找器
/ 選定的工具
■JSON Path 查找器 - 免費 開發者 工具
使用 JSONPath 表達式從 JSON 中查找並擷取值
■ 01
甚麼是 JSON Path?
JSON Path 是一種用於 JSON 的查詢語言,類似 XML 的 XPath。它讓你能使用路徑運算式在 JSON 文件中導覽並擷取資料。此工具能協助你測試與驗證你的 JSON path 運算式。
■ 02
運作原理是甚麼?
路徑語法:$ - 根元素;.property - 子屬性;[0] - 陣列索引;[*] - 所有元素;.. - 遞迴下降;[0:2] - 陣列切片;[-1] - 最後一個元素。常見用途:從 API 回應中擷取特定欄位;查…
■ 03
範例情境
涵蓋簡單屬性存取、陣列索引與萬用字元選取,讓你能快速比較常見的輸入與輸出。
/ 相關工具
/ 程式碼
■選定工具的原始碼,與右側的即時版本並列顯示。
/ 原始碼
TypeScript
typescript
// Simple JSON Path implementation in TypeScript
// No external dependencies required
type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };
function extractJsonPath(obj: JsonValue, path: string): JsonValue[] {
const results: JsonValue[] = [];
// Remove leading $ if present
let normalizedPath = path.startsWith('$') ? path.slice(1) : path;