Skip to content
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

feat(p/json): JSON path support #1937

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

notJoon
Copy link
Member

@notJoon notJoon commented Apr 16, 2024

Description

Implemented a feature that parses JSONPath expression using a state machine and extracts data matching the specified path from the input JSON data.

JSONPath is an expression used to select and filter specific data within a JSON data. This implementation supports the basic functionalities of JSONPath.

Here's a table summarizing the supported JSONPath features now:

Symbol Description Example
Root Object($) Represents the root object of the JSON. All paths start with this symbol $.store.book[0].title
Wildcard(*) Selects all elements of any object or array. $.store.*
Subscript Operator([]) Selects a specific element of an array or object using an index or a key. $.store.book[0]
Deep Scan(..) Selects the specified property regardless of the depth in the JSON. $..price
Slice Operator(:) Selects elements within a range in an array. $.store.book[0:2]

Currently, This implementation focuses on the basic functionality of JSON path expressions to prevent the size of PR is bigger. So, the filter expressions(?(@)) are not implemented yet. but this feature will be added with complex filtering and built-in functions.

I expect, with this JSONPath parser, users can easily extract and utilize desired information from within JSON data.

@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Apr 16, 2024
Copy link

codecov bot commented Apr 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.23%. Comparing base (68ef445) to head (6f2a50a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1937      +/-   ##
==========================================
+ Coverage   60.20%   60.23%   +0.02%     
==========================================
  Files         562      562              
  Lines       75038    75038              
==========================================
+ Hits        45177    45197      +20     
+ Misses      26482    26468      -14     
+ Partials     3379     3373       -6     
Flag Coverage Δ
contribs/gnodev 61.40% <ø> (ø)
contribs/gnofaucet 14.46% <ø> (-0.86%) ⬇️
gnovm 64.33% <ø> (ø)
misc/genstd 80.54% <ø> (ø)
misc/logos 20.23% <ø> (+0.35%) ⬆️
tm2 61.99% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@notJoon notJoon changed the title WIP: JSON path feat(p/json): JSON path support Apr 17, 2024
@notJoon notJoon marked this pull request as ready for review June 4, 2024 08:46
@notJoon notJoon requested review from a team as code owners June 4, 2024 08:46
@notJoon notJoon requested review from thehowl and ltzmaxwell and removed request for a team June 4, 2024 08:46
@github-actions github-actions bot added the 📦 🤖 gnovm Issues or PRs gnovm related label Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🤖 gnovm Issues or PRs gnovm related 🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: No status
Status: In Review
Status: No status
Status: In Review
Development

Successfully merging this pull request may close these issues.

1 participant