JSONPath Dot Notation ($.key)

Master JSONPath dot notation to access object properties directly. Learn how $.key selects values and when to use dot vs. bracket notation.

Basics

Detailed Explanation

Dot Notation in JSONPath

Dot notation is the most common way to access properties in a JSON object. It uses a period (.) followed by the property name, making expressions concise and readable.

Syntax

$.propertyName
$.parent.child.grandchild

How It Works

Given this JSON document:

{
  "user": {
    "name": "Bob",
    "email": "bob@example.com",
    "address": {
      "city": "Tokyo",
      "zip": "100-0001"
    }
  }
}
  • $.user.name returns "Bob"
  • $.user.address.city returns "Tokyo"
  • $.user.email returns "bob@example.com"

Each dot steps one level deeper into the object hierarchy. You chain as many dots as needed to reach deeply nested values.

Rules and Limitations

  1. Property names must be valid identifiers — names with spaces, hyphens, or special characters require bracket notation instead (e.g., $["first-name"]).
  2. Case-sensitive$.User and $.user are different paths.
  3. No result for missing keys — if a property does not exist, the expression returns an empty result set rather than an error.

Dot Notation vs. Bracket Notation

Feature Dot Notation Bracket Notation
Syntax $.key $["key"]
Special chars Not supported Supported
Readability Higher Lower
Dynamic keys No Yes

Dot notation is preferred for simple, clean property names and is the most common form you will encounter in JSONPath tutorials and documentation.

Use Case

Use dot notation for quickly extracting values from well-structured JSON APIs, configuration files, or database responses where property names follow standard naming conventions without special characters.

Try It — JSON Path Evaluator

Open full tool