Commit 4f91c7f
authored
parser_json: use JSON.parse instead of .load (#4817)
**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**:
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>1 parent 1d5b0de commit 4f91c7f
File tree
3 files changed
+4
-4
lines changed- lib/fluent/plugin
- test
- log
- plugin
3 files changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
0 commit comments