Skip to content

Recommendation: Replace JSON Pointer notation with JSON Path #34

Open

Description

@dubnemo

JSON pointer, while is works, requires pre-processing when working with arrays, to determine the index value.
The JSON Path approaches provides filtering that can identity the arrary entry.

{
  "phoneNumbers": [
    {
      "type"  : "Work",
      "number": "0123-4567-8888"
    },
        {
    "type"  : "Mobile",
      "number": "0123-4567-8888"
    },
    {
      "type"  : "Home",
      "number": "0123-4567-8910"
    }
  ]
}

$.phoneNumbers[?@.type == 'Work'].number will return the correct number to update.

You will have to write code to find the index value would need to be updated via JSON Pointer, in the previous case it would be:
/phoneNumbers/0/number

But for this scenario:

{
  "phoneNumbers": [
    {
      "type"  : "Mobile",
      "number": "0123-4567-8888"
    },
        {
    "type"  : "Home",
      "number": "0123-4567-8888"
    },
    {
      "type"  : "Work",
      "number": "0123-4567-8910"
    }
  ]
}

the JSON Pointer would be:
/phoneNumbers/2/number
as the Work array entry has an index value of 2.

JSON Path is much more robust than JSON Pointer, and would greatly improve JSON Patch.

Activity

  1. zbleness commented on May 7, 2026

    @zbleness

    I have an experimental implementation of this here: blenessy/python-jsonpath@d8bdcc8

  2. dubnemo commented on May 7, 2026

    @dubnemo
    Author

    @mnot not sure if you are actively working on JSON Patch 2. It seems the Newtonsoft folks would be interested in this as well as others.

  3. mnot commented on May 10, 2026

    @mnot
    Member

    Not actively; this repo is just for collecting requirements and gauging interest. I might do something at some point, and of course anyone can make proposals (e.g., in the IETF).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions