Skip to content

draft JSONPath documentation #19580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 9, 2025
Merged

draft JSONPath documentation #19580

merged 9 commits into from
May 9, 2025

Conversation

taroface
Copy link
Contributor

@taroface taroface commented May 1, 2025

@taroface taroface requested review from dikshant and DrewKimball May 1, 2025 21:45
Copy link

github-actions bot commented May 1, 2025

Files changed:

Copy link

netlify bot commented May 1, 2025

Deploy Preview for cockroachdb-interactivetutorials-docs canceled.

Name Link
🔨 Latest commit a5017b2
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-interactivetutorials-docs/deploys/681e7213a82a550008e70cc1

Copy link

netlify bot commented May 1, 2025

Deploy Preview for cockroachdb-api-docs canceled.

Name Link
🔨 Latest commit a5017b2
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-api-docs/deploys/681e72134ce81100084ecafb

Copy link

netlify bot commented May 1, 2025

Netlify Preview

Name Link
🔨 Latest commit a5017b2
🔍 Latest deploy log https://app.netlify.com/sites/cockroachdb-docs/deploys/681e7213679a6f0008f398e7
😎 Deploy Preview https://deploy-preview-19580--cockroachdb-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.


- `mode` is an optional mode (`lax` or `strict`) that determines how structural mismatches are tolerated. If not specified, the mode is `lax`. Refer to [Structural error handling](#structural-error-handling).
- `$` is the root of the JSONPath, and must be the first element in a JSONPath expression. For an example, refer to [Access entire document](#access-entire-document).
- `.key` is an optional key accessor that refers to a named field in a `JSONB` object. To access array elements, use `.key[index]` or `.key[*]`. Each successive key accessor navigates one level deeper into the structure. `.*` matches all fields in the current object.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make mention of the array accessor as it's own thing, I think. For example, you can do this:

root@localhost:26257/defaultdb> SELECT jsonb_path_query('[1, 2, 3]', '$[0]');
  jsonb_path_query
--------------------
                 1
(1 row)

Copy link

@DrewKimball DrewKimball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Nice work!

@taroface taroface requested a review from florence-crl May 9, 2025 16:44
Copy link
Contributor

@florence-crl florence-crl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm pending suggestions. Just an idea for the future: please use a more generic example, rather than US basketball.

@taroface
Copy link
Contributor Author

taroface commented May 9, 2025

@florence-crl TFTR! Point well taken on the example; it was developed from our internal materials and I did not realize that it could be potentially too specific.

@taroface taroface enabled auto-merge (squash) May 9, 2025 21:22
@taroface taroface merged commit 19e613b into main May 9, 2025
6 checks passed
@taroface taroface deleted the jsonpath branch May 9, 2025 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants