Skip to content

[ruby-compat/09] Fix double-encoding when converting json columns to JSON type - #118

Merged
chikamura merged 2 commits into
feature/ruby-compatibilityfrom
ruby-compat/09-fix-json-double-encoding
Sep 25, 2026
Merged

chikamura merged 2 commits into
feature/ruby-compatibilityfrom
ruby-compat/09-fix-json-double-encoding

Conversation

@chikamura

Copy link
Copy Markdown
Contributor

Summary

  • JsonColumnVisitor's else branch put the raw JSON string as a String value, which BigQuery's JSON loader re-encodes as a quoted string (e.g. {"msg":"hello"} became "{\"msg\":\"hello\"}").
  • Add a type: JSON branch that sets the parsed value directly instead, matching ruby's json_converter, which just passes the value through unchanged for that type.
  • Also document type: JSON as a supported column_options conversion target for json columns in README and BigqueryColumnOption, since it was previously implemented in ruby but undocumented in both projects.

Test plan

  • ./gradlew test (added testJsonColumnWithJsonTypeDoesNotDoubleEncode)
  • ./gradlew spotlessApply

🤖 Generated with Claude Code

json_column_visitor's else branch put the raw JSON string as a String
value, which BigQuery's JSON loader re-encodes as a quoted string
(e.g. {"msg":"hello"} became "{\"msg\":\"hello\"}"). Set the parsed
value directly for type: JSON instead, matching ruby's json_converter
which just passes the value through unchanged for that type.

Also document type: JSON as a supported column_options conversion
target for json columns in README and BigqueryColumnOption, since it
was previously implemented in ruby but undocumented in both projects.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@chikamura
chikamura changed the base branch from master to feature/ruby-compatibility September 16, 2026 02:09
…n-double-encoding

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@chikamura chikamura changed the title [WIP][ruby-compat/09] Fix double-encoding when converting json columns to JSON type [ruby-compat/09] Fix double-encoding when converting json columns to JSON type Sep 25, 2026
@chikamura
chikamura marked this pull request as ready for review September 25, 2026 04:38
@chikamura
chikamura requested a review from john-abre September 25, 2026 05:27

@john-abre john-abre left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ありがとうございます!

@chikamura
chikamura merged commit fdc53ea into feature/ruby-compatibility Sep 25, 2026
@chikamura
chikamura deleted the ruby-compat/09-fix-json-double-encoding branch September 25, 2026 07:17
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.

2 participants