Skip to content

Commit

Permalink
Add summary syntax table to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Sep 19, 2024
1 parent 525983e commit cd1be18
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
| `[<selectors>]` | child segment: selects zero or more children of a node |
| `.name` | shorthand for ['name'] |
| `.*` | shorthand for [*] |
| `..[<selectors>]` | 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 |
| `?<logical-expr>` | 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
Expand Down

0 comments on commit cd1be18

Please sign in to comment.