Browser-based Convert tool

JSONPath Extractor

Paste JSON and use paths such as $.users[].email or $.store.book[0].title.

100% 瀏覽器執行 · 不上傳伺服器 · 免費使用
Browser processing · up to 5 MB per file
0 chars
0 chars

JSONPath Extractor

Extract specific fields from JSON documents using standard JSONPath syntax. This tool takes a JSON document and a query path (such as $.users[*].email) and returns only the matching values. It is designed for developers and data engineers who need to quickly pull structured data from nested objects, logs, or API responses without writing a full parsing script.

How the extraction works

The tool processes everything locally in your browser. You provide two inputs: the JSON document and the JSONPath expression. The engine parses the JSON, repairs common syntax errors (like trailing commas or single quotes), and then traverses the structure based on your path.

  1. Prepare inputs: Paste your JSON content into the text area or load a local file. The file is read directly by the browser and never uploaded to a server.
  2. Define the path: Enter your JSONPath expression in the dedicated field. Use the widely supported subset including $ (root), .child, [0] (index), [*] (all items), and .. (descendant).
  3. Execute: Click Convert. The tool repairs the JSON if necessary and calculates the matching nodes.
  4. Review and copy: The results appear in the "Matching JSON values" panel. Copy the result or download it as a file. Keep your original JSON handy, as some transformations (like number formatting) are not reversible.

Syntax support and limitations

To ensure predictable results, the extractor uses a practical subset of JSONPath. It supports standard navigation but does not evaluate script filters or complex conditional logic.

  • Case sensitivity: Keys are case-sensitive. $.Name will not match $.name.
  • Zero-based indexing: Array access starts at index 0. $.items[0] refers to the first element.
  • Root anchor: Every path must begin with $ to anchor at the document root.
  • No script filters: Expressions like $.store.book[?(@.price < 10)] are not evaluated. Use simple selectors instead.

Handling messy JSON and numbers

The tool includes a repair step to handle common JSON inconsistencies. It removes trailing commas, strips comments, and ignores byte-order marks (BOM). It also converts single-quoted strings to double-quoted ones and quotes bare member names. However, it cannot infer missing structural elements like a closing brace; these require manual editing.

Be aware of numeric precision limits. JavaScript treats all numbers as IEEE-754 doubles. If your JSON contains integers larger than 2^53 (approximately 9,007,199,254,740,991), the parser may lose precision or rewrite the value. To preserve long IDs exactly as typed, keep them as strings in the source document.

When to use this tool

Use this extractor for quick debugging, documentation, data migration previews, or local file inspection where you need to see specific nodes in a large JSON file. It is not a replacement for a production-grade parser or a deployment validation pipeline. Always verify the output in the application that will consume it.

Important: browser parsers cover common practical cases. Always review generated files before using them in production, especially for configuration, subtitles, images and security-sensitive data.

Frequently asked questions

Why does my path return nothing?

Check three common issues: ensure your path starts with $, verify that your key names match the JSON exactly (case-sensitive), and confirm array indexes are zero-based. If the path uses syntax not in the supported subset (like script filters), it will not execute.

Can it fix JSON with trailing commas or comments?

Yes. The repair step automatically removes trailing commas, comments, and byte-order marks. It also normalizes single-quoted strings to double quotes and adds quotes to bare member names. However, it cannot guess missing structural characters like closing braces or parentheses; those require manual correction before the tool can process the file.

Why do large numbers change when I format JSON?

JavaScript numbers are IEEE-754 doubles, which lose precision for integers above 2^53. While this tool preserves the exact literal you typed in the output view, other parsers in your stack may not. To prevent data corruption, store large numeric IDs as strings in the source JSON document.

Which syntax is supported here?

The tool supports the widely used subset of JSONPath: $ (root), .child, [index], [*] (wildcard), and .. (descendant). It does not evaluate script filters, conditional expressions, or complex recursive logic.

Is my data uploaded to a server?

No. The JSON file and path expression are processed entirely in your browser. No data is sent to an external server. Do not paste secrets or personal data if you are using a shared device, as the input remains visible in the local interface.

What happens if the JSON is invalid?

The tool attempts to repair common errors (trailing commas, BOM, quotes). If the error is structural (like a missing brace or bracket), the tool will not be able to parse it. You must manually fix the JSON structure before extraction can occur.