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

parser_json: use JSON.parse instead of .load #4817

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

Watson1978
Copy link
Contributor

Which issue(s) this PR fixes:
Fixes #

What this PR does / why we need it:
Ref. #4813 (comment)
Fix wrong usage of JSON.load method.
We should use JSON.parse instead.

JSON.load performs unnecessary deserialisation.

irb(main):001> JSON.load('{ "json_class": "String", "raw": [72, 101, 108, 108, 111] }')
=> "Hello"
irb(main):002> JSON.parse('{ "json_class": "String", "raw": [72, 101, 108, 108, 111] }')
=> {"json_class" => "String", "raw" => [72, 101, 108, 108, 111]}

Docs Changes:

Release Note:

Copy link
Contributor

@daipom daipom left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@daipom
Copy link
Contributor

daipom commented Feb 4, 2025

I think backporting to LTS is unnecessary because no specific issues have been reported with this.

I cannot assume how much this could change Fluentd's behavior.
So, I'm a little concerned about backporting this to LTS.
I think we should not backport this unless we have a strong reason.

If anyone has an opinion that we should backport, please comment.

@daipom daipom merged commit 4f91c7f into fluent:master Feb 4, 2025
10 checks passed
@Watson1978 Watson1978 deleted the json-parse branch February 4, 2025 07:09
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