Skip to content

New nodes: 'Format JSON', 'Query JSON', and 'Query JSON All', replacing the 'JSON Get' node#4044

Merged
Keavon merged 2 commits intomasterfrom
json-nodes
Apr 24, 2026
Merged

New nodes: 'Format JSON', 'Query JSON', and 'Query JSON All', replacing the 'JSON Get' node#4044
Keavon merged 2 commits intomasterfrom
json-nodes

Conversation

@Keavon
Copy link
Copy Markdown
Member

@Keavon Keavon commented Apr 24, 2026

Category - Text: JSON

  • Format JSON: Pretty prints (or compacts) a valid JSON string.
  • Query JSON: Obtain a value accessed with JS array/object accessor syntax from a valid JSON string.
  • Query JSON All: Obtain all values (as a list) accessed with JS array/object accessor syntax from a valid JSON string, where [] accesses all.

Broken out from #4010.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new suite of JSON processing nodes, including "Format JSON", "Query JSON", and "Query JSON All", while deprecating the older "json_get" implementation. These new nodes provide advanced capabilities for reformatting JSON strings and extracting data using a custom path syntax. The review feedback identifies several areas for improvement in the path parser, such as the need for robust escape sequence handling and support for single-quoted keys to match JavaScript's accessor syntax. Additionally, a bug was found in the string serialization logic where manual quoting failed to properly escape internal characters, which can be resolved by leveraging built-in serialization methods.

Comment thread node-graph/nodes/text/src/json.rs
Comment thread node-graph/nodes/text/src/json.rs Outdated
Comment on lines +293 to +298
if c == '\\' {
chars.next();
if let Some(&escaped) = chars.peek() {
key.push(escaped);
chars.next();
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The escape handling for quoted keys in the path parser is too simplistic. It currently just strips the backslash and pushes the next character, which means \n becomes n instead of a newline character. Consider using the existing unescape_string utility or implementing proper JSON escape sequence support.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

3 issues found across 4 files

Confidence score: 3/5

  • There is concrete user-impact risk in node-graph/nodes/text/src/json.rs: quoted string output is not JSON-safe because escaping is bypassed, which can produce invalid JSON or incorrect serialized values.
  • editor/src/messages/portfolio/document_migration.rs misses an alias for the previous graphene_std JSON Get identifier, so older serialized documents may fail to migrate to query_json as expected.
  • This looks mergeable with caution, but the combination of two high-confidence 7/10 issues plus a 6/10 parser-validation issue raises meaningful regression risk beyond a minor cleanup.
  • Pay close attention to node-graph/nodes/text/src/json.rs and editor/src/messages/portfolio/document_migration.rs - JSON escaping/path validation and backward-compat migration behavior are the key risk areas.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="node-graph/nodes/text/src/json.rs">

<violation number="1" location="node-graph/nodes/text/src/json.rs:280">
P2: Malformed quoted-bracket paths are accepted instead of rejected because closing `]` is not required.</violation>

<violation number="2" location="node-graph/nodes/text/src/json.rs:356">
P1: Quoted string output is not JSON-safe because it bypasses escaping. Use serde_json serialization for strings.</violation>
</file>

<file name="editor/src/messages/portfolio/document_migration.rs">

<violation number="1" location="editor/src/messages/portfolio/document_migration.rs:680">
P1: This rename updates the destination identifier but does not add the previous `graphene_std` JSON Get identifier as an alias, so documents serialized with the old std identifier will not be migrated to `query_json`.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread node-graph/nodes/text/src/json.rs Outdated
Comment thread editor/src/messages/portfolio/document_migration.rs
Comment thread node-graph/nodes/text/src/json.rs
@Keavon
Copy link
Copy Markdown
Member Author

Keavon commented Apr 24, 2026

@cubic-dev-ai

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Apr 24, 2026

@cubic-dev-ai

@Keavon I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@Keavon Keavon merged commit c32c808 into master Apr 24, 2026
11 checks passed
@Keavon Keavon deleted the json-nodes branch April 24, 2026 07:26
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.

1 participant