JSON Path Tester

Query nested JSON fields with simple paths like user.profile.name or items[0].id.

Back to all tools on ToolForge

More in JSON & API

JSON Input



Path Expression



Result


About JSON Path Tester

This JSON path tester allows you to query nested JSON structures using simple dot notation and bracket syntax. It helps developers quickly extract specific values from complex API responses, configuration files, and data payloads without writing code.

It is useful for API debugging, webhook payload inspection, configuration file navigation, data transformation workflows, and verifying field presence before processing in applications.

Path Notation Syntax

Two notation styles are supported for navigating JSON structures:

Dot Notation (for object properties):
  user.name           → Accesses "name" property of "user" object
  user.profile.email  → Nested property access
  data.config.value   → Deep nesting with multiple levels

Bracket Notation (for arrays):
  items[0]            → First element of array (0-indexed)
  users[5]            → Sixth element
  data[0].id          → ID of first array element

Combined Notation:
  users[0].name       → Name of first user
  posts[2].author.id  → Author ID of third post
  data.items[1].price → Price of second item

JSON Structure Examples

Path JSON Structure Result
user.name {"user":{"name":"John"}} "John"
items[0] {"items":[1,2,3]} 1
user.address.city {"user":{"address":{"city":"NYC"}}} "NYC"
users[1].email {"users":[{"email":"[email protected]"},{"email":"[email protected]"}]} "[email protected]"
data[0].items[2] {"data":[{"items":["a","b","c"]}]} "c"

Common Use Cases

Code Examples by Language

JavaScript:
  // Dot notation
  const name = data.user.profile.name;

  // Bracket notation
  const firstItem = items[0];
  const propName = data['my-property'];

  // Dynamic path resolution
  function getByPath(obj, path) {
    return path.split('.').reduce((acc, part) => {
      const match = part.match(/(.+)\[(\d+)\]/);
      if (match) {
        return acc[match[1]]?.[parseInt(match[2])];
      }
      return acc?.[part];
    }, obj);
  }

Python:
  # Dot notation equivalent
  name = data['user']['profile']['name']

  # Using get for safe access
  name = data.get('user', {}).get('profile', {}).get('name')

  # With jsonpath-ng library
  from jsonpath_ng import parse
  jsonpath = parse('user.profile.name')
  result = jsonpath.find(data)

PHP:
  // Object notation
  $name = $data->user->profile->name;

  // Array notation
  $name = $data['user']['profile']['name'];

  // Using null coalescing
  $name = $data['user']['profile']['name'] ?? null;

Java:
  // Using Jackson library
  JsonNode root = objectMapper.readTree(jsonString);
  JsonNode name = root.get("user").get("profile").get("name");
  String value = name.asText();

  // Using JsonPath library
  String name = JsonPath.read(json, "$.user.profile.name");

Limitations

Best Practices

Frequently Asked Questions

What is JSON path notation?
JSON path notation is a way to navigate nested JSON structures using a string expression. Dot notation (user.profile.name) accesses object properties, while bracket notation (items[0]) accesses array indices. Combined paths like users[0].address.city traverse deep into nested structures.
How do I access array elements in JSON?
Use zero-based bracket notation: array[0] gets the first element, array[1] gets the second. You can combine with dot notation: users[0].name gets the name property of the first user. Negative indices are not supported in standard JSON path.
What happens if the path doesn't exist?
If any part of the path doesn't exist (undefined property or out-of-bounds array index), the query returns an error. This helps identify missing fields in API responses or configuration files.
Can I use this for JSONPath or JQ expressions?
This tool uses simple dot and bracket notation only. It does not support advanced JSONPath features like wildcards (*), recursive descent (..), or filter expressions [?(@.age>18)]. For complex queries, consider dedicated JSONPath or jq tools.
How are special characters in property names handled?
Property names with special characters or spaces require bracket notation with quotes: data['my-property'] or data['field name']. Dot notation only works with valid JavaScript identifier names (letters, digits, underscores, no leading digits).
What are common use cases for JSON path queries?
Common uses include: extracting specific fields from API responses, validating webhook payloads, debugging nested configuration files, transforming JSON data structures, and verifying data presence before processing in applications.