Skip to content

fix: use JSON.pretty_generate (pretty_unparse removed in json 3.0) - #72

Open
aim2bpg wants to merge 1 commit into
aws:mainfrom
aim2bpg:fix/json-3-pretty-unparse-removed
Open

aim2bpg wants to merge 1 commit into
aws:mainfrom
aim2bpg:fix/json-3-pretty-unparse-removed

Conversation

@aim2bpg

@aim2bpg aim2bpg commented Oct 10, 2026

Copy link
Copy Markdown

JSON.pretty_unparse was removed in json 3.0.0.rc1 (ruby/json CHANGES.md). Under json >= 3.0, any unhandled exception reaching LambdaLogger.log_error crashes with NoMethodError instead of reporting the original error.

pretty_generate is the documented replacement, present since json 0.4.2 (2006), so this works under json 2.x and 3.x alike.

Repro:

require 'json'
JSON.pretty_unparse({ a: 1 }) # NoMethodError under json 3.0

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