$.

JSON Path Extractor

Extract nested values using dot paths, indexes, and wildcards

Examples: users.*.email or orders[0].total

JSON Path Extractor — what it does

Pull values out of nested JSON with a dot path, array indexes and wildcards — users.*.email to collect every address, or orders[0].total for one specific value. It is a query language small enough to type from memory, against a document you have in the clipboard.

Worked example

Three orders with nested customer objects; the path orders.*.customer.email collects every customer address.

Input — JSON and path orders.*.customer.email

{"orders":[
{"id":1001,"customer":{"name":"Ann Lee","email":"ann.lee@example.com"},"total":42},
{"id":1002,"customer":{"name":"Ben Ortiz","email":"ben.ortiz@example.com"},"total":26.97},
{"id":1004,"customer":{"name":"Dev Patel","email":"dev.patel@example.com"},"total":42}
]}

Output — 3 result(s)

[
  "ann.lee@example.com",
  "ben.ortiz@example.com",
  "dev.patel@example.com"
]

A path with a single match is shown unwrapped: orders[0].total gives 42, not [42]. orders.*.customer.phone gives [] and 0 result(s).

When this tool helps

  • Collecting one field from every item in an API response, such as all IDs or all emails.
  • Reaching a single deeply buried value without scrolling through the whole document.
  • Checking whether a field exists across every record in a payload.

How to use it

  1. Paste the JSON document.
  2. Enter a path such as users.*.email or orders[0].total.
  3. Process the extraction.
  4. Copy the extracted values.

Accuracy, limits, and good practice

  • The wildcard collects across every element at that level, which is how you turn an array of objects into a plain list of one field.
  • Array indexes start at zero, so orders[0] is the first order — the classic off-by-one when translating from a spreadsheet mindset.
  • An empty result usually means a mistyped path segment; check the exact key spelling against the formatted document.

Frequently asked questions

How do I get every value at one level?

Use the wildcard: items.*.price returns the price from every item in the array.

Is this the same as JSONPath?

It is a simplified form of the same idea, covering dot paths, indexes and wildcards without the full specification's filter syntax.

How do I filter rather than extract?

The JSON array filter selects whole items by a condition; this tool pulls values out once you know which items you want.

Why is a single match not wrapped in an array?

When exactly one value matches, that value itself is shown (orders[0].total gives 42, orders.1.customer gives the object); with several or no matches you get an array, so [] means nothing matched.

Can the wildcard be used on an object?

Yes: orders.0.customer.* lists that object's values (Ann Lee, ann.lee@example.com). Indexes may be written orders[1] or orders.1; both reach the second order.

Related tools on this site

Everything above runs inside this page. JSON Path Extractor needs no account, no upload, and no server round trip — close the tab and nothing is left behind.

JSON 路徑提取能做什麼

用點路徑、陣列索引與萬用字元從巢狀 JSON 取值——users.*.email 收集所有信箱,orders[0].total 取單一數值。它是一種小到可以憑記憶打出來的查詢語法,對象就是你剪貼簿裡那份文件。

實際範例

三筆帶巢狀 customer 物件的訂單;路徑 orders.*.customer.email 收集每位客戶的 email。

來源:JSON 與路徑 orders.*.customer.email

{"orders":[
{"id":1001,"customer":{"name":"Ann Lee","email":"ann.lee@example.com"},"total":42},
{"id":1002,"customer":{"name":"Ben Ortiz","email":"ben.ortiz@example.com"},"total":26.97},
{"id":1004,"customer":{"name":"Dev Patel","email":"dev.patel@example.com"},"total":42}
]}

得到 3 result(s)

[
  "ann.lee@example.com",
  "ben.ortiz@example.com",
  "dev.patel@example.com"
]

只比對到一個值的路徑會直接顯示該值:orders[0].total 得到 42 而不是 [42]。orders.*.customer.phone 得到 [] 與 0 result(s)。

什麼時候用得上

  • 從 API 回應的每個項目中收集同一個欄位,例如所有 ID 或所有信箱。
  • 不必捲完整份文件,直接取到深埋的某個值。
  • 檢查載荷中每筆紀錄是否都有某個欄位。

使用步驟

  1. 貼上 JSON 文件。
  2. 輸入路徑,例如 users.*.email 或 orders[0].total。
  3. 執行提取。
  4. 複製取得的值。

精確度、限制與實務建議

  • 萬用字元會橫跨該層的每個元素,這正是把物件陣列變成單一欄位清單的方法。
  • 陣列索引從 0 開始,orders[0] 是第一筆訂單——從試算表思維切換過來時最常見的差一錯誤。
  • 結果為空通常代表路徑某一段打錯字;請對照格式化後的文件確認鍵名拼寫。

常見問題

怎麼取某一層的全部值?

用萬用字元:items.*.price 會回傳陣列中每個項目的價格。

這跟 JSONPath 一樣嗎?

是同一概念的簡化版,涵蓋點路徑、索引與萬用字元,不含完整規格的篩選語法。

我要篩選而不是取值怎麼辦?

JSON 陣列篩選器可依條件挑出整個項目;本工具則是在你知道要哪些項目後負責取值。

為什麼單一比對不會包成陣列?

剛好只有一個值符合時,顯示的就是該值本身(orders[0].total 得到 42,orders.1.customer 得到那個物件);多個或零個符合時才會是陣列,所以 [] 代表沒有比對到。

星號可以放在物件上嗎?

可以:orders.0.customer.* 會列示該物件的所有值(Ann Lee、ann.lee@example.com)。索引寫成 orders[1] 或 orders.1 都行,兩種都能到第二筆訂單。

本站相關工具

以上步驟全部在這個頁面內完成,JSON 路徑提取 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。