JSON Array Filter
Filter JSON array items by a nested field and condition
JSON Array Filter — what it does
Filter a JSON array by a field — including a nested one addressed with a dot path — using rules for equals, not equal, contains, greater than, less than and exists. The matching items are returned as a new JSON array you can download, which is a query against a document without a database in sight.
Worked example
Five staff records with a nested office object, filtered with field path office.city, rule Equals and value Taipei.
Input — JSON array (path office.city equals Taipei)
[
{"name":"Ann Lee","dept":"Sales","office":{"city":"Taipei"},"salary":52000},
{"name":"Ben Ortiz","dept":"Engineering","office":{"city":"Austin"},"salary":88000},
{"name":"Chloe Park","dept":"Sales","office":{"city":"Taipei"},"salary":47500},
{"name":"Dev Patel","dept":"Support","office":{"city":"Lisbon"},"salary":41000},
{"name":"Emma Rossi","dept":"Engineering","office":{"city":"Austin"},"salary":91000}
]Output — 2 matching item(s), also saved as filtered.json
[
{
"name": "Ann Lee",
"dept": "Sales",
"office": {
"city": "Taipei"
},
"salary": 52000
},
{
"name": "Chloe Park",
"dept": "Sales",
"office": {
"city": "Taipei"
},
"salary": 47500
}
]Items keep their original order and full contents. On the same data, salary › Greater than › 50000 returns 3 items.
When this tool helps
- Pulling the failed entries out of a large API response for investigation.
- Reducing an export to the records matching one status, region or type before sharing it.
- Checking which objects in a payload are missing a required field, using the exists rule.
How to use it
- Paste the JSON array.
- Enter the field path, such as user.address.city.
- Choose a rule and enter the comparison value.
- Process and download the filtered JSON.
Accuracy, limits, and good practice
- Dot paths reach into nested objects, so profile.contact.email works as long as every item shares that shape.
- The exists rule is the one for auditing data quality — it finds the records where a field is missing rather than merely empty.
- Numeric comparisons need real JSON numbers; a value stored as "42" in quotes compares as text and will not behave as expected.
Frequently asked questions
Can I apply two conditions at once?
Filter, then filter the result again. Successive passes combine as an AND.
What if the top level is an object, not an array?
Extract the array first with the JSON path extractor, then filter it here.
Does the original order survive?
Yes. Matching items are returned in the order they appeared in the source array.
Are text comparisons case-sensitive?
Equals and Not equal are exact (taipei matched nothing while Taipei matched two), but Contains ignores case. Those three rules compare the value as text, so a number 52000 equals the typed value 52000.
What happens when an item does not have the field?
Its value counts as undefined: Exists drops it, Equals never matches it, and Not equal always matches it. Filtering office.phone not equal to x returned all five records in the example because none has a phone, so run Exists first when fields are optional.
Related tools on this site
- CSV to JSON — Convert CSV rows into JSON objects
- JSON Key Renamer — Rename matching object keys recursively throughout JSON data
- CSV Column Splitter — Split one CSV field into multiple columns by a delimiter
Further reading: Cleaning a CSV export before you import it anywhere · CSV, JSON, YAML, XML and Markdown Tables: When Each Fits and How to Convert
Everything above runs inside this page. JSON Array Filter needs no account, no upload, and no server round trip — close the tab and nothing is left behind.
JSON 陣列篩選器能做什麼
以欄位篩選 JSON 陣列——包含用點路徑指到的巢狀欄位——支援等於、不等於、包含、大於、小於與存在等規則。符合的項目會回傳成可下載的新 JSON 陣列,等於在沒有資料庫的情況下對文件下了一次查詢。
實際範例
五筆帶巢狀 office 物件的員工資料,以欄位路徑 office.city、規則 Equals、值 Taipei 篩選。
來源:JSON 陣列(路徑 office.city 等於 Taipei)
[
{"name":"Ann Lee","dept":"Sales","office":{"city":"Taipei"},"salary":52000},
{"name":"Ben Ortiz","dept":"Engineering","office":{"city":"Austin"},"salary":88000},
{"name":"Chloe Park","dept":"Sales","office":{"city":"Taipei"},"salary":47500},
{"name":"Dev Patel","dept":"Support","office":{"city":"Lisbon"},"salary":41000},
{"name":"Emma Rossi","dept":"Engineering","office":{"city":"Austin"},"salary":91000}
]得到 2 matching item(s),同時可存成 filtered.json
[
{
"name": "Ann Lee",
"dept": "Sales",
"office": {
"city": "Taipei"
},
"salary": 52000
},
{
"name": "Chloe Park",
"dept": "Sales",
"office": {
"city": "Taipei"
},
"salary": 47500
}
]符合的項目保持原本順序與完整內容。同一份資料改跑 salary › Greater than › 50000 會得到 3 筆。
什麼時候用得上
- 從龐大的 API 回應中撈出失敗的項目以便追查。
- 分享前先把匯出檔縮減成符合某一狀態、地區或類型的紀錄。
- 用「存在」規則檢查載荷中哪些物件缺少必要欄位。
使用步驟
- 貼上 JSON 陣列。
- 輸入欄位路徑,例如 user.address.city。
- 選擇規則並輸入比較值。
- 執行處理並下載篩選後的 JSON。
精確度、限制與實務建議
- 點路徑可深入巢狀物件,只要每個項目結構一致,profile.contact.email 就有效。
- 「存在」規則是資料品質稽核的利器——它找的是「欄位不存在」而不只是「值為空」。
- 數值比較需要真正的 JSON 數字;以 "42" 這種引號字串儲存的值會被當文字比較,行為不如預期。
常見問題
可以同時套用兩個條件嗎?
先篩一次,再把結果篩第二次。連續篩選等同 AND。
如果最外層是物件而不是陣列呢?
請先用 JSON 路徑提取工具取出陣列,再回來篩選。
原本的順序會保留嗎?
會。符合的項目依它們在來源陣列中的順序回傳。
文字比較會區分大小寫嗎?
Equals 與 Not equal 是逐字比對(taipei 比不到任何一筆,Taipei 比到兩筆),Contains 則不分大小寫。這三條規則都把值當文字比,所以數字 52000 與打的 52000 相等。
項目沒有那個欄位時會怎樣?
它的值視為 undefined:Exists 會把它排掉,Equals 永遠比不到,Not equal 則一定符合。範例裡以 office.phone 不等於 x 篩選會得到全部五筆,因為沒有人有 phone;欄位可有可無時,先以 Exists 篩一次。
本站相關工具
- CSV 轉 JSON — 將 CSV 資料列轉換成 JSON 物件
- JSON 鍵名批量重新命名 — 在整份 JSON 中遞迴重新命名符合的物件鍵名
- CSV 欄位拆分 — 依分隔符將單一 CSV 欄位拆成多欄
延伸閱讀: 匯入之前先把 CSV 匯出檔清乾淨 · CSV、JSON、YAML、XML 與 Markdown 表格:各自適用的場合與轉換方法
以上步驟全部在這個頁面內完成,JSON 陣列篩選器 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。