jsonsql.dev 100% client-side
?>

JSON Query

Query JSON with PATH, SQL & MongoDB syntax — instantly in your browser

Data Map
Dot notation: obj.key | Arrays: arr[0] | Wildcard: arr[*].key | Filter: arr[age > 30]
Run a query to see results
PATH mode

How to query JSON online

jsonsql.dev lets you query JSON data instantly in your browser using three powerful syntaxes: Path, SQL, and MongoDB. No data is sent to any server — your JSON stays on your machine.

Paste your JSON — copy JSON from your API response, database export, or config file and paste it into the input editor.

Write your query — choose Path, SQL, or MongoDB mode and type your query in the query bar. Press Enter or click Run.

View results — results display as a formatted table (for tabular data) or as highlighted JSON. Copy results with one click.

Path query examples

Dot notation to navigate nested JSON:

// Input
{
  "employees": [
    { "name": "Alice", "age": 32, "department": "Engineering" },
    { "name": "Bob", "age": 28, "department": "Design" },
    { "name": "Carol", "age": 35, "department": "Engineering" }
  ]
}

// Path queries
employees[0].name           → "Alice"
employees[*].name           → ["Alice", "Bob", "Carol"]
employees[age > 30]         → [{ "name": "Alice", ... }, { "name": "Carol", ... }]
employees[department = "Engineering"]  → filters to Engineering staff

SQL query examples

Query JSON arrays using familiar SQL syntax with SELECT, WHERE, ORDER BY, GROUP BY, and aggregate functions:

// Select specific columns
SELECT name, age FROM employees WHERE age > 30

// Aggregate functions
SELECT department, COUNT(*) as count, AVG(salary) as avg_salary
FROM employees
GROUP BY department

// Sorting and limiting
SELECT name, salary FROM employees ORDER BY salary DESC LIMIT 5

// LIKE and IN operators
SELECT * FROM employees WHERE name LIKE "A%"
SELECT * FROM employees WHERE department IN ("Engineering", "Design")

MongoDB query examples

Use MongoDB-style query operators on JSON arrays:

// Simple match
{ "department": "Engineering" }

// Comparison operators
{ "salary": { "$gte": 100000 } }
{ "age": { "$gt": 25, "$lt": 40 } }

// $in operator
{ "department": { "$in": ["Engineering", "Design"] } }

// With sort and limit
{ "$query": { "department": "Engineering" }, "$sort": { "salary": -1 }, "$limit": 5 }

Features

  • Three query modes: Path (dot notation), SQL (SELECT/WHERE/GROUP BY), and MongoDB ($gt, $in, $sort)
  • Path mode supports wildcards (employees[*].name) and array filters ([age > 30])
  • SQL mode supports SELECT, FROM, WHERE, ORDER BY, LIMIT, GROUP BY with aggregate functions (COUNT, SUM, AVG, MIN, MAX)
  • MongoDB mode supports $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, plus $sort, $limit, $skip, $project
  • Results displayed as formatted tables for tabular data, or syntax-highlighted JSON
  • Shows row count and query execution time
  • Built-in sample data to try queries immediately
  • Works offline — no internet needed after the page loads
  • 100% client-side — no data is ever sent to any server

JSON query syntax guide

jsonsql.dev lets you query JSON using three familiar syntaxes — JSONPath dot notation, SQL SELECT statements, and MongoDB-style queries — all running entirely in your browser.

PATH syntax reference

Path mode uses dot notation and bracket notation to navigate JSON structures. It is the fastest way to extract specific values from deeply nested data.

  • Dot notationemployees[0].name accesses the name field of the first employee.
  • Bracket notation["field name"] lets you access keys that contain spaces or special characters.
  • Wildcardsemployees[*].name returns an array of all name values across every element.
  • Array filtersemployees[age > 30] filters elements using comparison operators (=, !=, >, <, >=, <=).
// Sample data
{
  "company": {
    "employees": [
      { "name": "Alice", "age": 32, "role": "Lead" },
      { "name": "Bob", "age": 28, "role": "Developer" },
      { "name": "Carol", "age": 35, "role": "Architect" }
    ]
  }
}

// Example 1: Nested dot notation
company.employees[0].name
→ "Alice"

// Example 2: Wildcard to extract all values
company.employees[*].role
→ ["Lead", "Developer", "Architect"]

// Example 3: Filter with comparison
company.employees[age >= 30]
→ [{ "name": "Alice", "age": 32, ... }, { "name": "Carol", "age": 35, ... }]

// Example 4: Bracket notation for special keys
company["employees"][0]["name"]
→ "Alice"

SQL syntax reference

SQL mode lets you query JSON arrays using the same SELECT statements you already know from relational databases. Supported clauses: SELECT, FROM, WHERE, GROUP BY, ORDER BY, and LIMIT. Aggregate functions include COUNT, SUM, AVG, MIN, and MAX.

// Sample data
{
  "orders": [
    { "id": 1, "customer": "Alice", "product": "Laptop", "amount": 1200, "status": "shipped" },
    { "id": 2, "customer": "Bob", "product": "Phone", "amount": 800, "status": "pending" },
    { "id": 3, "customer": "Alice", "product": "Tablet", "amount": 450, "status": "shipped" },
    { "id": 4, "customer": "Carol", "product": "Laptop", "amount": 1200, "status": "delivered" }
  ]
}

// Example 1: SELECT with WHERE
SELECT customer, product, amount FROM orders WHERE amount > 500
→ [{ "customer": "Alice", "product": "Laptop", "amount": 1200 }, ...]

// Example 2: GROUP BY with aggregate
SELECT customer, COUNT(*) as total_orders, SUM(amount) as total_spent
FROM orders GROUP BY customer
→ [{ "customer": "Alice", "total_orders": 2, "total_spent": 1650 }, ...]

// Example 3: ORDER BY + LIMIT
SELECT product, amount FROM orders ORDER BY amount DESC LIMIT 2
→ [{ "product": "Laptop", "amount": 1200 }, { "product": "Laptop", "amount": 1200 }]

// Example 4: LIKE and IN operators
SELECT * FROM orders WHERE status IN ("shipped", "delivered")
SELECT * FROM orders WHERE customer LIKE "A%"

MongoDB syntax reference

MongoDB mode uses JSON-based query objects with operators familiar to MongoDB developers. Comparison operators: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin. Logical operators: $and, $or. Result shaping: $sort, $limit, $project.

// Sample data
{
  "products": [
    { "name": "Widget", "price": 25, "category": "Tools", "rating": 4.5 },
    { "name": "Gadget", "price": 75, "category": "Electronics", "rating": 3.8 },
    { "name": "Gizmo", "price": 150, "category": "Electronics", "rating": 4.9 },
    { "name": "Doohickey", "price": 10, "category": "Tools", "rating": 4.2 }
  ]
}

// Example 1: Simple equality match
{ "category": "Electronics" }
→ [{ "name": "Gadget", ... }, { "name": "Gizmo", ... }]

// Example 2: Comparison operators
{ "price": { "$gte": 25, "$lte": 100 } }
→ [{ "name": "Widget", "price": 25, ... }, { "name": "Gadget", "price": 75, ... }]

// Example 3: $or logical operator
{ "$or": [{ "category": "Tools" }, { "rating": { "$gte": 4.5 } }] }
→ [{ "name": "Widget", ... }, { "name": "Gizmo", ... }, { "name": "Doohickey", ... }]

// Example 4: Sort, limit, and project
{
  "$query": { "category": "Electronics" },
  "$sort": { "price": -1 },
  "$limit": 1,
  "$project": { "name": 1, "price": 1 }
}
→ [{ "name": "Gizmo", "price": 150 }]

JSONPath vs SQL vs MongoDB: which query syntax to use

Each query syntax has strengths. Choose the one that matches your task:

  • PATH — best for quickly extracting a specific value or navigating deeply nested structures. If you know exactly where the data lives, dot notation is the fastest way to get there.
  • SQL — best for filtering, sorting, and aggregating arrays of objects. If your JSON looks like database rows and you want GROUP BY with COUNT/SUM/AVG, SQL is the natural choice.
  • MongoDB — best for complex nested filter conditions with logical operators ($and, $or). If you are already familiar with MongoDB queries, this mode feels like home.
Capability PATH SQL MongoDB
Access a single nested value Best Possible No
Extract all values of a field Yes ([*].field) Yes (SELECT field) Yes ($project)
Filter by condition Basic ([age > 30]) Full (WHERE) Full ($gt, $in)
Logical AND / OR No Yes (AND, OR) Yes ($and, $or)
Sorting No Yes (ORDER BY) Yes ($sort)
Limit results No Yes (LIMIT) Yes ($limit)
Aggregation (COUNT, SUM, AVG) No Yes (GROUP BY) No
Pattern matching No Yes (LIKE) No
Nested object navigation Best Limited (dot paths) Limited (flat match)
Learning curve Low Low (familiar SQL) Medium

Real-world JSON query examples

Practical examples using a realistic dataset. Paste this sample data into jsonsql.dev and try each query:

// Sample data for all examples below
{
  "employees": [
    { "name": "Alice", "age": 32, "department": "Engineering", "salary": 125000 },
    { "name": "Bob", "age": 28, "department": "Design", "salary": 95000 },
    { "name": "Carol", "age": 35, "department": "Engineering", "salary": 140000 },
    { "name": "David", "age": 41, "department": "Marketing", "salary": 110000 },
    { "name": "Eve", "age": 26, "department": "Engineering", "salary": 105000 },
    { "name": "Frank", "age": 38, "department": "Design", "salary": 115000 },
    { "name": "Grace", "age": 30, "department": "Marketing", "salary": 98000 },
    { "name": "Hank", "age": 45, "department": "Engineering", "salary": 155000 }
  ]
}

Find all users older than 30

// PATH
employees[age > 30]
→ [{ "name": "Alice", "age": 32, ... }, { "name": "Carol", "age": 35, ... },
   { "name": "David", "age": 41, ... }, { "name": "Frank", "age": 38, ... },
   { "name": "Hank", "age": 45, ... }]

// SQL
SELECT name, age FROM employees WHERE age > 30 ORDER BY age
→ Alice (32), Carol (35), Frank (38), David (41), Hank (45)

// MongoDB
{ "age": { "$gt": 30 } }
→ same 5 employees

Get average salary by department

// SQL (best syntax for aggregation)
SELECT department, COUNT(*) as headcount, AVG(salary) as avg_salary,
       MIN(salary) as min_salary, MAX(salary) as max_salary
FROM employees GROUP BY department

→ Engineering:  headcount=4, avg_salary=131250, min=105000, max=155000
→ Design:       headcount=2, avg_salary=105000, min=95000, max=115000
→ Marketing:    headcount=2, avg_salary=104000, min=98000, max=110000

Find employees with salary between $100K and $130K

// PATH
employees[salary >= 100000]
// then visually filter (PATH has single-condition filters)

// SQL
SELECT name, department, salary FROM employees
WHERE salary >= 100000 AND salary <= 130000
ORDER BY salary DESC
→ [{ "name": "Alice", "salary": 125000 }, { "name": "Frank", "salary": 115000 },
   { "name": "David", "salary": 110000 }, { "name": "Eve", "salary": 105000 }]

// MongoDB
{ "salary": { "$gte": 100000, "$lte": 130000 } }
→ same 4 employees

Get top 5 highest-paid employees

// SQL
SELECT name, department, salary FROM employees
ORDER BY salary DESC LIMIT 5
→ Hank (155000), Carol (140000), Alice (125000), Frank (115000), David (110000)

// MongoDB
{
  "$query": {},
  "$sort": { "salary": -1 },
  "$limit": 5,
  "$project": { "name": 1, "department": 1, "salary": 1 }
}
→ same top 5

Querying JSON without installing anything

The most popular command-line tool for querying JSON is jq. It is powerful but requires installation, terminal access, and learning a unique filter syntax. jsonsql.dev provides the same core capabilities directly in your browser with syntaxes you already know.

Aspect jsonsql.dev jq (CLI)
Installation None — open a browser tab Install via brew, apt, choco, or download binary
Syntax PATH, SQL, or MongoDB — choose what you know jq filter language (unique to jq)
Learning curve Low — SQL mode is familiar to most developers Steep — pipe-based functional syntax
Visual output Formatted tables and syntax-highlighted JSON Text output in terminal
Aggregate functions COUNT, SUM, AVG, MIN, MAX via SQL mode group_by + length / add (manual piping)
Privacy 100% client-side — no data leaves your browser 100% local (runs on your machine)
Scripting / automation No (interactive tool) Yes (pipeable, scriptable)
Large files (100MB+) Browser memory limited Streaming support

For quick, one-off queries on API responses or config files, jsonsql.dev is faster than installing jq. For automated pipelines and shell scripts, jq remains the right tool.

jq vs jsonsql.dev examples

// Task: Get names of employees older than 30

// jq (CLI)
cat data.json | jq '.employees[] | select(.age > 30) | .name'

// jsonsql.dev — PATH mode
employees[age > 30]
// then: employees[*].name (to extract names only)

// jsonsql.dev — SQL mode
SELECT name FROM employees WHERE age > 30

// jsonsql.dev — MongoDB mode
{ "age": { "$gt": 30 } }
// Task: Count employees per department

// jq (CLI)
cat data.json | jq '.employees | group_by(.department) | map({department: .[0].department, count: length})'

// jsonsql.dev — SQL mode
SELECT department, COUNT(*) as count FROM employees GROUP BY department

JSON Query vs other tools

Feature jsonsql.dev jq (CLI) JSONPath Online
Browser-based Yes No (CLI) Yes
Client-side only Yes Yes (local) Varies
Path syntax Yes Yes (own syntax) Yes
SQL syntax Yes No No
MongoDB syntax Yes No No
Table output Yes No No
Aggregate functions Yes (COUNT, SUM, AVG, MIN, MAX) Yes (group_by, length) No
No install needed Yes No Yes
Dark mode Yes N/A No

Related tools

Frequently asked questions

What are the differences between Path, SQL, and MongoDB query modes?

Path mode uses dot notation for quick navigation (employees[0].name). SQL mode uses SELECT/WHERE/GROUP BY for tabular queries with aggregation. MongoDB mode uses JSON objects with $ operators ($gt, $in, $or) for filtering. Path is simplest, SQL is best for aggregation, MongoDB is best for complex nested conditions.

How do I filter JSON arrays by a field value across all three modes?

In Path mode use employees[department = "Engineering"]. In SQL mode use SELECT * FROM employees WHERE department = "Engineering". In MongoDB mode use {"department": "Engineering"}. All three syntaxes support equality and comparison operators.

Can I query nested JSON objects?

Yes. Use dot notation in Path mode (e.g., config.database.host), nested column references in SQL mode, or nested match objects in MongoDB mode. Path mode is the best choice for deeply nested structures.

How do I switch between query modes and when should I use each?

Click the Path, SQL, or MongoDB tab above the query bar to switch modes. Use Path for quick data extraction and navigation, SQL when you need GROUP BY or aggregate functions (COUNT, SUM, AVG), and MongoDB when you need complex boolean logic with $and/$or/$in.

How do I sort a JSON array by a field?

In SQL mode, use ORDER BY: SELECT * FROM employees ORDER BY salary DESC. In MongoDB mode, add $sort to your query: {"$query": {}, "$sort": {"salary": -1}}. Use DESC or -1 for descending order, ASC or 1 for ascending.

What's the difference between jsonsql.dev and jq?

jq uses a pipe-based functional syntax (.employees[] | select(.age > 30) | .name) that is powerful but has a steep learning curve. jsonsql.dev offers three familiar syntaxes — dot notation, SQL, and MongoDB — covering most jq use cases without installing anything.

Can I load JSON from a URL or API endpoint?

Yes. Paste any public URL into the Fetch URL field and click Load. The tool fetches the JSON directly from your browser using a CORS proxy — no data passes through jsonsql.dev servers. This works with REST APIs, GitHub raw files, and public JSON endpoints.

How large a JSON file can I query in the browser?

The tool handles JSON files up to 50-100 MB depending on your browser and device memory. Chrome and Edge typically handle larger files than Firefox or Safari. For files over 100 MB, consider using DuckDB or jq on the command line instead.

Is my data safe? Does anything get uploaded?

Your data never leaves your browser. All parsing, querying, and formatting happens 100% client-side using JavaScript. There are no server calls, no analytics on your data, and no cookies tracking your input. The tool works fully offline after the first page load.

Which query mode should I choose for aggregating JSON data?

Use SQL mode for aggregation. It supports GROUP BY with COUNT, SUM, AVG, MIN, and MAX — the same syntax you already know from databases. Path mode extracts values but cannot aggregate, and MongoDB mode filters documents but does not compute totals or averages.