From cd1be18b68593563824a893469d6fb033394b179 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Thu, 19 Sep 2024 11:40:41 -0400 Subject: [PATCH] Add summary syntax table to readme --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index e568351..d131d5e 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,27 @@ RFC 9535 JSONPath in Go The jsonpath package provides [RFC 9535 JSONPath] functionality in Go. +## JSONPath Expressions + +A brief overview of RFC [9535 JSONPath] syntax: + +| Syntax Element | Description** | +| ------------------ | ----------------------------------------------------------------------- | +| `$` | root node identifier | +| `@` | current node identifier (valid only within filter selectors) | +| `[]` | child segment: selects zero or more children of a node | +| `.name` | shorthand for ['name'] | +| `.*` | shorthand for [*] | +| `..[]` | descendant segment: selects zero or more descendants of a node | +| `..name` | shorthand for ..['name'] | +| `..*` | shorthand for ..[*] | +| `'name'` | name selector: selects a named child of an object | +| `*` | wildcard selector: selects all children of a node | +| `3` | index selector: selects an indexed child of an array (from 0) | +| `0:100:5` | array slice selector: start:end:step for arrays | +| `?` | filter selector: selects particular children using a logical expression | | +| `length(@.foo)` | function extension: invokes a function in a filter expression | + ## Package Stability The root `jsonpath` package is stable and ready for use. These are the main