multi_json 1.14.1 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +102 -100
- data/CONTRIBUTING.md +1 -1
- data/LICENSE.md +1 -1
- data/README.md +19 -26
- data/lib/multi_json/adapter.rb +21 -14
- data/lib/multi_json/adapter_error.rb +5 -7
- data/lib/multi_json/adapters/gson.rb +2 -3
- data/lib/multi_json/adapters/jr_jackson.rb +3 -3
- data/lib/multi_json/adapters/json_gem.rb +26 -3
- data/lib/multi_json/adapters/json_pure.rb +2 -6
- data/lib/multi_json/adapters/oj.rb +31 -31
- data/lib/multi_json/adapters/ok_json.rb +3 -3
- data/lib/multi_json/adapters/yajl.rb +3 -3
- data/lib/multi_json/convertible_hash_keys.rb +29 -21
- data/lib/multi_json/options.rb +23 -13
- data/lib/multi_json/options_cache.rb +43 -19
- data/lib/multi_json/parse_error.rb +8 -8
- data/lib/multi_json/vendor/okjson.rb +145 -206
- data/lib/multi_json/version.rb +3 -3
- data/lib/multi_json.rb +59 -48
- metadata +15 -51
- data/lib/multi_json/adapters/json_common.rb +0 -23
- data/lib/multi_json/adapters/nsjsonserialization.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cfed43da6fae7ff4d1ca11dc248a43fe89d00f184f2e955599467a7b45b6cbe
|
4
|
+
data.tar.gz: d6d16e3c6fd7c3334bf7b44b84896f6ac675dd503ccf4ffc6d2bc2ef415098c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2712e385429e988fddeca64fbe93347eb3a2f6d5d4c3fa83f9ffb40e292e09f35fdf1ee0b82be7d6caa8ccd1d09995f41cb7803546b12e8f3082190bd5556625
|
7
|
+
data.tar.gz: bb3cd2dd7a39f1a6d7aa8b52d2786d908e2e15bc5ed94d750ef458666ef903bcccf2383883841d11795f972bf5923170d84410a1459aa14792448c6d0b583ff8
|
data/CHANGELOG.md
CHANGED
@@ -1,259 +1,263 @@
|
|
1
|
-
1.
|
1
|
+
1.16.0
|
2
|
+
------
|
3
|
+
* [Remove `NSJSONSerialization`](https://github.com/sferik/multi_json/commit/0423d3b5886e93405f4c2221687b7e3329bd2940)
|
4
|
+
* [Stop referencing `JSON::PRETTY_STATE_PROTOTYPE`](https://github.com/sferik/multi_json/commit/58094d7a0583bf1f5052886806a032c00f16ffc5)
|
5
|
+
* [Drop support for Ruby versions < 3.2](https://github.com/sferik/multi_json/commit/ff3b42c4bc26cd6512914b7e5321976e948985dc)
|
6
|
+
* [Move repo from @intridea to @sferik](https://github.com/sferik/multi_json/commit/e87aeadbc9b9aa6df79818fa01bfc5fa959d8474)
|
7
|
+
* [`JsonCommon`: force encoding to UTF-8, not binary](https://github.com/sferik/multi_json/commit/34dd0247de07f2703c7d42a42d4cefc73635f3cc)
|
8
|
+
* [Stop setting defaults in `JsonCommon`](https://github.com/sferik/multi_json/commit/d5f9e6e72b99a7def695f430f72c8365998de625)
|
9
|
+
* [Make `json_pure` an alias of `json_gem`](https://github.com/sferik/multi_json/commit/9ff7c3dcbe3650e712b38e636ad19061a4c08d1a)
|
10
|
+
|
11
|
+
1.15.0
|
2
12
|
------
|
13
|
+
* [Improve detection of json_gem adapter](https://github.com/sferik/multi_json/commit/62d54019b17ebf83b28c8deb871a02a122e7d9cf)
|
3
14
|
|
4
|
-
|
15
|
+
1.14.1
|
16
|
+
------
|
17
|
+
* [Fix a warning in Ruby 2.7](https://github.com/sferik/multi_json/commit/26a94ab8c78a394cc237e2ea292c1de4f6ed30d7)
|
5
18
|
|
6
19
|
1.14.0
|
7
20
|
------
|
8
|
-
|
9
|
-
* [Support Oj 3.x gem](https://github.com/intridea/multi_json/commit/5d8febdbebc428882811b90d514f3628617a61d5)
|
21
|
+
* [Support Oj 3.x gem](https://github.com/sferik/multi_json/commit/5d8febdbebc428882811b90d514f3628617a61d5)
|
10
22
|
|
11
23
|
1.13.1
|
12
24
|
------
|
13
|
-
|
14
|
-
* [Fix missing stdlib set dependency in oj adapter](https://github.com/intridea/multi_json/commit/c4ff66e7bee6fb4f45e54429813d7fada1c152b8)
|
25
|
+
* [Fix missing stdlib set dependency in oj adapter](https://github.com/sferik/multi_json/commit/c4ff66e7bee6fb4f45e54429813d7fada1c152b8)
|
15
26
|
|
16
27
|
1.13.0
|
17
28
|
-----
|
18
|
-
|
19
|
-
* [Make Oj adapter handle JSON::ParseError correctly](https://github.com/intridea/multi_json/commit/275e3ffd8169797c510d23d9ef5b8b07e64c3b42)
|
29
|
+
* [Make Oj adapter handle JSON::ParseError correctly](https://github.com/sferik/multi_json/commit/275e3ffd8169797c510d23d9ef5b8b07e64c3b42)
|
20
30
|
|
21
31
|
1.12.2
|
22
32
|
------
|
23
|
-
|
24
|
-
* [Renew gem certificate](https://github.com/intridea/multi_json/commit/57922d898c6eb587cc9a28ba5724c11e81724700)
|
33
|
+
* [Renew gem certificate](https://github.com/sferik/multi_json/commit/57922d898c6eb587cc9a28ba5724c11e81724700)
|
25
34
|
|
26
35
|
1.12.1
|
27
36
|
------
|
28
|
-
|
29
|
-
* [Prevent memory leak in OptionsCache](https://github.com/intridea/multi_json/commit/aa7498199ad272f3d4a13750d7c568a66047e2ee)
|
37
|
+
* [Prevent memory leak in OptionsCache](https://github.com/sferik/multi_json/commit/aa7498199ad272f3d4a13750d7c568a66047e2ee)
|
30
38
|
|
31
39
|
1.12.0
|
32
40
|
------
|
33
|
-
|
34
|
-
* [Introduce global options cache to improve peroformance](https://github.com/intridea/multi_json/commit/7aaef2a1bc2b83c95e4208b12dad5d1d87ff20a6)
|
41
|
+
* [Introduce global options cache to improve peroformance](https://github.com/sferik/multi_json/commit/7aaef2a1bc2b83c95e4208b12dad5d1d87ff20a6)
|
35
42
|
|
36
43
|
1.11.2
|
37
44
|
------
|
38
|
-
|
39
|
-
* [Only pass one argument to JrJackson when two is not supported](https://github.com/intridea/multi_json/commit/e798fa517c817fc706982d3f3c61129b6651d601)
|
45
|
+
* [Only pass one argument to JrJackson when two is not supported](https://github.com/sferik/multi_json/commit/e798fa517c817fc706982d3f3c61129b6651d601)
|
40
46
|
|
41
47
|
1.11.1
|
42
48
|
------
|
43
|
-
|
44
|
-
* [Dump method passes options throught for JrJackson adapter](https://github.com/intridea/multi_json/commit/3c730fd12135c3e7bf212f878958004908f13909)
|
49
|
+
* [Dump method passes options throught for JrJackson adapter](https://github.com/sferik/multi_json/commit/3c730fd12135c3e7bf212f878958004908f13909)
|
45
50
|
|
46
51
|
1.11.0
|
47
52
|
------
|
48
|
-
|
49
|
-
* [Make all adapters read IO object before load](https://github.com/intridea/multi_json/commit/167f559e18d4efee05e1f160a2661d16dbb215d4)
|
53
|
+
* [Make all adapters read IO object before load](https://github.com/sferik/multi_json/commit/167f559e18d4efee05e1f160a2661d16dbb215d4)
|
50
54
|
|
51
55
|
1.10.1
|
52
56
|
------
|
53
|
-
* [Explicitly require stringio for Gson adapter](https://github.com/
|
54
|
-
* [Do not read StringIO object before passing it to JrJackson](https://github.com/
|
57
|
+
* [Explicitly require stringio for Gson adapter](https://github.com/sferik/multi_json/commit/623ec8142d4a212fa0db763bb71295789a119929)
|
58
|
+
* [Do not read StringIO object before passing it to JrJackson](https://github.com/sferik/multi_json/commit/a6dc935df08e7b3d5d701fbb9298384c96df0fde)
|
55
59
|
|
56
60
|
1.10.0
|
57
61
|
------
|
58
|
-
* [Performance tweaks](https://github.com/
|
62
|
+
* [Performance tweaks](https://github.com/sferik/multi_json/commit/58724acfed31866d079eaafb1cd824e341ade287)
|
59
63
|
|
60
64
|
1.9.3
|
61
65
|
-----
|
62
|
-
* [Convert indent option to Fixnum before passing to Oj](https://github.com/
|
66
|
+
* [Convert indent option to Fixnum before passing to Oj](https://github.com/sferik/multi_json/commit/826fc5535b863b74fc9f981dfdda3e26f1ee4e5b)
|
63
67
|
|
64
68
|
1.9.2
|
65
69
|
-----
|
66
|
-
* [Enable use_to_json option for Oj adapter by default](https://github.com/
|
70
|
+
* [Enable use_to_json option for Oj adapter by default](https://github.com/sferik/multi_json/commit/76a4aaf697b10bbabd5d535d83cf1149efcfe5c7)
|
67
71
|
|
68
72
|
1.9.1
|
69
73
|
-----
|
70
|
-
* [Remove unused LoadError file](https://github.com/
|
74
|
+
* [Remove unused LoadError file](https://github.com/sferik/multi_json/commit/65dedd84d59baeefc25c477fedf0bbe85e7ce2cd)
|
71
75
|
|
72
76
|
1.9.0
|
73
77
|
----
|
74
|
-
* [Rename LoadError to ParseError](https://github.com/
|
75
|
-
* [Adapter load failure throws AdapterError instead of ArgumentError](https://github.com/
|
78
|
+
* [Rename LoadError to ParseError](https://github.com/sferik/multi_json/commit/4abb98fe3a90b2a7b3d1594515c8a06042b4a27d)
|
79
|
+
* [Adapter load failure throws AdapterError instead of ArgumentError](https://github.com/sferik/multi_json/commit/4da612b617bd932bb6fa1cc4c43210327f98f271)
|
76
80
|
|
77
81
|
1.8.4
|
78
82
|
-----
|
79
|
-
* [Make Gson adapter explicitly read StringIO object](https://github.com/
|
83
|
+
* [Make Gson adapter explicitly read StringIO object](https://github.com/sferik/multi_json/commit/b58b498747ff6e94f41488c971b2a30a98760ef2)
|
80
84
|
|
81
85
|
1.8.3
|
82
86
|
-----
|
83
|
-
* [Make JrJackson explicitly read StringIO objects](https://github.com/
|
84
|
-
* [Prevent calling #downcase on alias symbols](https://github.com/
|
87
|
+
* [Make JrJackson explicitly read StringIO objects](https://github.com/sferik/multi_json/commit/e1f162d5b668e5e4db5afa175361a601a8aa2b05)
|
88
|
+
* [Prevent calling #downcase on alias symbols](https://github.com/sferik/multi_json/commit/c1cf075453ce0110f7decc4f906444b1233bb67c)
|
85
89
|
|
86
90
|
1.8.2
|
87
91
|
-----
|
88
|
-
* [Downcase adapter string name for OS compatibility](https://github.com/
|
92
|
+
* [Downcase adapter string name for OS compatibility](https://github.com/sferik/multi_json/commit/b8e15a032247a63f1410d21a18add05035f3fa66)
|
89
93
|
|
90
94
|
1.8.1
|
91
95
|
-----
|
92
|
-
* [Let the adapter handle strings with invalid encoding](https://github.com/
|
96
|
+
* [Let the adapter handle strings with invalid encoding](https://github.com/sferik/multi_json/commit/6af2bf87b89f44eabf2ae9ca96779febc65ea94b)
|
93
97
|
|
94
98
|
1.8.0
|
95
99
|
-----
|
96
|
-
* [Raise MultiJson::LoadError on blank input](https://github.com/
|
100
|
+
* [Raise MultiJson::LoadError on blank input](https://github.com/sferik/multi_json/commit/c44f9c928bb25fe672246ad394b3e5b991be32e6)
|
97
101
|
|
98
102
|
1.7.9
|
99
103
|
-----
|
100
|
-
* [Explicitly require json gem code even when constant is defined](https://github.com/
|
104
|
+
* [Explicitly require json gem code even when constant is defined](https://github.com/sferik/multi_json/commit/36f7906c66477eb4b55b7afeaa3684b6db69eff2)
|
101
105
|
|
102
106
|
1.7.8
|
103
107
|
-----
|
104
|
-
* [Reorder JrJackson before json_gem](https://github.com/
|
105
|
-
* [Update vendored OkJson to version 43](https://github.com/
|
108
|
+
* [Reorder JrJackson before json_gem](https://github.com/sferik/multi_json/commit/315b6e460b6e4dcdb6c82e04e4be8ee975d395da)
|
109
|
+
* [Update vendored OkJson to version 43](https://github.com/sferik/multi_json/commit/99a6b662f6ef4036e3ee94d7eb547fa72fb2ab50)
|
106
110
|
|
107
111
|
1.7.7
|
108
112
|
-----
|
109
|
-
* [Fix options caching issues](https://github.com/
|
113
|
+
* [Fix options caching issues](https://github.com/sferik/multi_json/commit/a3f14c3661688c5927638fa6088c7b46a67e875e)
|
110
114
|
|
111
115
|
1.7.6
|
112
116
|
-----
|
113
|
-
* [Bring back MultiJson::VERSION constant](https://github.com/
|
117
|
+
* [Bring back MultiJson::VERSION constant](https://github.com/sferik/multi_json/commit/31b990c2725e6673bf8ce57540fe66b57a751a72)
|
114
118
|
|
115
119
|
1.7.5
|
116
120
|
-----
|
117
|
-
* [Fix warning '*' interpreted as argument prefix](https://github.com/
|
118
|
-
* [Remove stdlib warning](https://github.com/
|
121
|
+
* [Fix warning '*' interpreted as argument prefix](https://github.com/sferik/multi_json/commit/b698962c7f64430222a1f06430669706a47aff89)
|
122
|
+
* [Remove stdlib warning](https://github.com/sferik/multi_json/commit/d06eec6b7996ac8b4ff0e2229efd835379b0c30f)
|
119
123
|
|
120
124
|
1.7.4
|
121
125
|
-----
|
122
|
-
* [Cache options for better performance](https://github.com/
|
126
|
+
* [Cache options for better performance](https://github.com/sferik/multi_json/commit/8a26ee93140c4bed36194ed9fb887a1b6919257b)
|
123
127
|
|
124
128
|
1.7.3
|
125
129
|
-----
|
126
|
-
* [Require json/ext to ensure extension version gets loaded for json_gem](https://github.com/
|
127
|
-
* [Rename JrJackson](https://github.com/
|
128
|
-
* [Prefer JrJackson to JSON gem if present](https://github.com/
|
129
|
-
* [Print a warning if outdated gem versions are used](https://github.com/
|
130
|
-
* [Loosen required_rubygems_version for compatibility with Ubuntu 10.04](https://github.com/
|
130
|
+
* [Require json/ext to ensure extension version gets loaded for json_gem](https://github.com/sferik/multi_json/commit/942686f7e8597418c6f90ee69e1d45242fac07b1)
|
131
|
+
* [Rename JrJackson](https://github.com/sferik/multi_json/commit/078de7ba8b6035343c3e96b4767549e9ec43369a)
|
132
|
+
* [Prefer JrJackson to JSON gem if present](https://github.com/sferik/multi_json/commit/af8bd9799a66855f04b3aff1c488485950cec7bf)
|
133
|
+
* [Print a warning if outdated gem versions are used](https://github.com/sferik/multi_json/commit/e7438e7ba2be0236cfa24c2bb9ad40ee821286d1)
|
134
|
+
* [Loosen required_rubygems_version for compatibility with Ubuntu 10.04](https://github.com/sferik/multi_json/commit/59fad014e8fe41dbc6f09485ea0dc21fc42fd7a7)
|
131
135
|
|
132
136
|
1.7.2
|
133
137
|
-----
|
134
|
-
* [Rename Jrjackson adapter to JrJackson](https://github.com/
|
135
|
-
* [Implement jrjackson -> jr_jackson alias for back-compatability](https://github.com/
|
136
|
-
* [Update vendored OkJson module](https://github.com/
|
138
|
+
* [Rename Jrjackson adapter to JrJackson](https://github.com/sferik/multi_json/commit/b36dc915fc0e6548cbad06b5db6f520e040c9c8b)
|
139
|
+
* [Implement jrjackson -> jr_jackson alias for back-compatability](https://github.com/sferik/multi_json/commit/aa50ab8b7bb646b8b75d5d65dfeadae8248a4f10)
|
140
|
+
* [Update vendored OkJson module](https://github.com/sferik/multi_json/commit/30a3f474e17dd86a697c3fab04f468d1a4fd69d7)
|
137
141
|
|
138
142
|
1.7.1
|
139
143
|
-----
|
140
|
-
* [Fix capitalization of JrJackson class](https://github.com/
|
144
|
+
* [Fix capitalization of JrJackson class](https://github.com/sferik/multi_json/commit/5373a5e38c647f02427a0477cb8e0e0dafad1b8d)
|
141
145
|
|
142
146
|
1.7.0
|
143
147
|
-----
|
144
|
-
* [Add load_options/dump_options to MultiJson](https://github.com/
|
145
|
-
* [MultiJson does not modify arguments](https://github.com/
|
146
|
-
* [Enable quirks_mode by default for json_gem/json_pure adapters](https://github.com/
|
147
|
-
* [Add JrJackson adapter](https://github.com/
|
148
|
-
* [Raise ArgumentError on bad adapter input](https://github.com/
|
148
|
+
* [Add load_options/dump_options to MultiJson](https://github.com/sferik/multi_json/commit/a153956be6b0df06ea1705ce3c1ff0b5b0e27ea5)
|
149
|
+
* [MultiJson does not modify arguments](https://github.com/sferik/multi_json/commit/58525b01c4c2f6635ba2ac13d6fd987b79f3962f)
|
150
|
+
* [Enable quirks_mode by default for json_gem/json_pure adapters](https://github.com/sferik/multi_json/commit/1fd4e6635c436515b7d7d5a0bee4548de8571520)
|
151
|
+
* [Add JrJackson adapter](https://github.com/sferik/multi_json/commit/4dd86fa96300aaaf6d762578b9b31ea82adb056d)
|
152
|
+
* [Raise ArgumentError on bad adapter input](https://github.com/sferik/multi_json/commit/911a3756bdff2cb5ac06497da3fa3e72199cb7ad)
|
149
153
|
|
150
154
|
1.6.1
|
151
155
|
-----
|
152
|
-
* [Revert "Use JSON.generate instead of #to_json"](https://github.com/
|
156
|
+
* [Revert "Use JSON.generate instead of #to_json"](https://github.com/sferik/multi_json/issues/86)
|
153
157
|
|
154
158
|
1.6.0
|
155
159
|
-----
|
156
|
-
* [Add gson.rb support](https://github.com/
|
157
|
-
* [Add MultiJson.default_options](https://github.com/
|
158
|
-
* [Add MultiJson.with_adapter](https://github.com/
|
159
|
-
* [Stringify all possible keys for ok_json](https://github.com/
|
160
|
-
* [Use JSON.generate instead of #to_json](https://github.com/
|
161
|
-
* [Alias `MultiJson::DecodeError` to `MultiJson::LoadError`](https://github.com/
|
160
|
+
* [Add gson.rb support](https://github.com/sferik/multi_json/pull/71)
|
161
|
+
* [Add MultiJson.default_options](https://github.com/sferik/multi_json/pull/70)
|
162
|
+
* [Add MultiJson.with_adapter](https://github.com/sferik/multi_json/pull/67)
|
163
|
+
* [Stringify all possible keys for ok_json](https://github.com/sferik/multi_json/pull/66)
|
164
|
+
* [Use JSON.generate instead of #to_json](https://github.com/sferik/multi_json/issues/73)
|
165
|
+
* [Alias `MultiJson::DecodeError` to `MultiJson::LoadError`](https://github.com/sferik/multi_json/pull/79)
|
162
166
|
|
163
167
|
1.5.1
|
164
168
|
-----
|
165
|
-
* [Do not allow Oj or JSON to create symbols by searching for classes](https://github.com/
|
169
|
+
* [Do not allow Oj or JSON to create symbols by searching for classes](https://github.com/sferik/multi_json/commit/193e28cf4dc61b6e7b7b7d80f06f74c76df65c41)
|
166
170
|
|
167
171
|
1.5.0
|
168
172
|
-----
|
169
|
-
* [Add `MultiJson.with_adapter` method](https://github.com/
|
170
|
-
* [Stringify all possible keys for `ok_json`](https://github.com/
|
173
|
+
* [Add `MultiJson.with_adapter` method](https://github.com/sferik/multi_json/commit/d14c5d28cae96557a0421298621b9499e1f28104)
|
174
|
+
* [Stringify all possible keys for `ok_json`](https://github.com/sferik/multi_json/commit/73998074058e1e58c557ffa7b9541d486d6041fa)
|
171
175
|
|
172
176
|
1.4.0
|
173
177
|
-----
|
174
|
-
* [Allow `load`/`dump` of JSON fragments](https://github.com/
|
178
|
+
* [Allow `load`/`dump` of JSON fragments](https://github.com/sferik/multi_json/commit/707aae7d48d39c85b38febbd2c210ba87f6e4a36)
|
175
179
|
|
176
180
|
1.3.7
|
177
181
|
-----
|
178
|
-
* [Fix rescue clause for MagLev](https://github.com/
|
179
|
-
* [Remove unnecessary check for string version of options key](https://github.com/
|
180
|
-
* [Explicitly set default adapter when adapter is set to `nil` or `false`](https://github.com/
|
181
|
-
* [Fix Oj `ParseError` mapping for Oj 1.4.0](https://github.com/
|
182
|
+
* [Fix rescue clause for MagLev](https://github.com/sferik/multi_json/commit/39abdf50199828c50e85b2ce8f8ba31fcbbc9332)
|
183
|
+
* [Remove unnecessary check for string version of options key](https://github.com/sferik/multi_json/commit/660101b70e962b3c007d0b90d45944fa47d13ec4)
|
184
|
+
* [Explicitly set default adapter when adapter is set to `nil` or `false`](https://github.com/sferik/multi_json/commit/a9e587d5a63eafb4baee9fb211265e4dd96a26bc)
|
185
|
+
* [Fix Oj `ParseError` mapping for Oj 1.4.0](https://github.com/sferik/multi_json/commit/7d9045338cc9029401c16f3c409d54ce97f275e2)
|
182
186
|
|
183
187
|
1.3.6
|
184
188
|
-----
|
185
|
-
* [Allow adapter-specific options to be passed through to Oj](https://github.com/
|
189
|
+
* [Allow adapter-specific options to be passed through to Oj](https://github.com/sferik/multi_json/commit/d0e5feeebcba0bc69400dd203a295f5c30971223)
|
186
190
|
|
187
191
|
1.3.5
|
188
192
|
-----
|
189
|
-
* [Add pretty support to Oj adapter](https://github.com/
|
193
|
+
* [Add pretty support to Oj adapter](https://github.com/sferik/multi_json/commit/0c8f75f03020c53bcf4c6be258faf433d24b2c2b)
|
190
194
|
|
191
195
|
1.3.4
|
192
196
|
-----
|
193
|
-
* [Use `class << self` instead of `module_function` to create aliases](https://github.com/
|
197
|
+
* [Use `class << self` instead of `module_function` to create aliases](https://github.com/sferik/multi_json/commit/ba1451c4c48baa297e049889be241a424cb05980)
|
194
198
|
|
195
199
|
1.3.3
|
196
200
|
-----
|
197
|
-
* [Remove deprecation warnings](https://github.com/
|
201
|
+
* [Remove deprecation warnings](https://github.com/sferik/multi_json/commit/36b524e71544eb0186826a891bcc03b2820a008f)
|
198
202
|
|
199
203
|
1.3.2
|
200
204
|
-----
|
201
|
-
* [Add ability to use adapter per call](https://github.com/
|
202
|
-
* [Add and deprecate `default_engine` method](https://github.com/
|
205
|
+
* [Add ability to use adapter per call](https://github.com/sferik/multi_json/commit/106bbec469d5d0a832bfa31fffcb8c0f0cdc9bd3)
|
206
|
+
* [Add and deprecate `default_engine` method](https://github.com/sferik/multi_json/commit/fc3df0c7a3e2ab9ce0c2c7e7617a4da97dd13f6e)
|
203
207
|
|
204
208
|
1.3.1
|
205
209
|
-----
|
206
|
-
* [Only warn once for each instance a deprecated method is called](https://github.com/
|
210
|
+
* [Only warn once for each instance a deprecated method is called](https://github.com/sferik/multi_json/commit/e21d6eb7da74b3f283995c1d27d5880e75f0ae84)
|
207
211
|
|
208
212
|
1.3.0
|
209
213
|
-----
|
210
|
-
* [Implement `load`/`dump`; deprecate `decode`/`encode`](https://github.com/
|
211
|
-
* [Rename engines to adapters](https://github.com/
|
214
|
+
* [Implement `load`/`dump`; deprecate `decode`/`encode`](https://github.com/sferik/multi_json/commit/e90fd6cb1b0293eb0c73c2f4eb0f7a1764370216)
|
215
|
+
* [Rename engines to adapters](https://github.com/sferik/multi_json/commit/ae7fd144a7949a9c221dcaa446196ec23db908df)
|
212
216
|
|
213
217
|
1.2.0
|
214
218
|
-----
|
215
|
-
* [Add support for Oj](https://github.com/
|
219
|
+
* [Add support for Oj](https://github.com/sferik/multi_json/commit/acd06b233edabe6c44f226873db7b49dab560c60)
|
216
220
|
|
217
221
|
1.1.0
|
218
222
|
-----
|
219
|
-
* [`NSJSONSerialization` support for MacRuby](https://github.com/
|
223
|
+
* [`NSJSONSerialization` support for MacRuby](https://github.com/sferik/multi_json/commit/f862e2fc966cac8867fe7da3997fc76e8a6cf5d4)
|
220
224
|
|
221
225
|
1.0.4
|
222
226
|
-----
|
223
|
-
* [Set data context to `DecodeError` exception](https://github.com/
|
224
|
-
* [Allow `ok_json` to fallback to `to_json`](https://github.com/
|
225
|
-
* [Add warning when using `ok_json`](https://github.com/
|
226
|
-
* [Options can be passed to an engine on encode](https://github.com/
|
227
|
+
* [Set data context to `DecodeError` exception](https://github.com/sferik/multi_json/commit/19ddafd44029c6681f66fae2a0f6eabfd0f85176)
|
228
|
+
* [Allow `ok_json` to fallback to `to_json`](https://github.com/sferik/multi_json/commit/c157240b1193b283d06d1bd4d4b5b06bcf3761f8)
|
229
|
+
* [Add warning when using `ok_json`](https://github.com/sferik/multi_json/commit/dd4b68810c84f826fb98f9713bfb29ab96888d57)
|
230
|
+
* [Options can be passed to an engine on encode](https://github.com/sferik/multi_json/commit/e0a7ff5d5ff621ffccc61617ed8aeec5816e81f7)
|
227
231
|
|
228
232
|
1.0.3
|
229
233
|
-----
|
230
|
-
* [`Array` support for `stringify_keys`](https://github.com/
|
231
|
-
* [`Array` support for `symbolize_keys`](https://github.com/
|
234
|
+
* [`Array` support for `stringify_keys`](https://github.com/sferik/multi_json/commit/644d1c5c7c7f6a27663b11668527b346094e38b9)
|
235
|
+
* [`Array` support for `symbolize_keys`](https://github.com/sferik/multi_json/commit/c885377d47a2aa39cb0d971fea78db2d2fa479a7)
|
232
236
|
|
233
237
|
1.0.2
|
234
238
|
-----
|
235
|
-
* [Allow encoding of rootless JSON when `ok_json` is used](https://github.com/
|
239
|
+
* [Allow encoding of rootless JSON when `ok_json` is used](https://github.com/sferik/multi_json/commit/d1cde7de97cb0f6152aef8daf14037521cdce8c6)
|
236
240
|
|
237
241
|
1.0.1
|
238
242
|
-----
|
239
|
-
* [Correct an issue with `ok_json` not being returned as the default engine](https://github.com/
|
243
|
+
* [Correct an issue with `ok_json` not being returned as the default engine](https://github.com/sferik/multi_json/commit/d33c141619c54cccd770199694da8fd1bd8f449d)
|
240
244
|
|
241
245
|
1.0.0
|
242
246
|
-----
|
243
|
-
* [Remove `ActiveSupport::JSON` support](https://github.com/
|
244
|
-
* [Fix `@engine` ivar warning](https://github.com/
|
245
|
-
* [Only `rescue` from parsing errors during decoding, not any `StandardError`](https://github.com/
|
246
|
-
* [Rename `okjson` engine and vendored lib to `ok_json`](https://github.com/
|
247
|
-
* [Add `StringIO` support to `json` gem and `ok_json`](https://github.com/
|
247
|
+
* [Remove `ActiveSupport::JSON` support](https://github.com/sferik/multi_json/commit/c2f4140141d785a24b3f56e58811b0e561b37f6a)
|
248
|
+
* [Fix `@engine` ivar warning](https://github.com/sferik/multi_json/commit/3b978a8995721a8dffedc3b75a7f49e5494ec553)
|
249
|
+
* [Only `rescue` from parsing errors during decoding, not any `StandardError`](https://github.com/sferik/multi_json/commit/391d00b5e85294d42d41347605d8d46b4a7f66cc)
|
250
|
+
* [Rename `okjson` engine and vendored lib to `ok_json`](https://github.com/sferik/multi_json/commit/5bd1afc977a8208ddb0443e1d57cb79665c019f1)
|
251
|
+
* [Add `StringIO` support to `json` gem and `ok_json`](https://github.com/sferik/multi_json/commit/1706b11568db7f50af451fce5f4d679aeb3bbe8f)
|
248
252
|
|
249
253
|
0.0.5
|
250
254
|
-----
|
251
|
-
* [Trap all JSON decoding errors; raise `MultiJson::DecodeError`](https://github.com/
|
255
|
+
* [Trap all JSON decoding errors; raise `MultiJson::DecodeError`](https://github.com/sferik/multi_json/commit/dea9a1aef6dd1212aa1e5a37ab1669f9b045b732)
|
252
256
|
|
253
257
|
0.0.4
|
254
258
|
-----
|
255
|
-
* [Fix default_engine check for `json` gem](https://github.com/
|
256
|
-
* [Make requirement mapper an `Array` to preserve order in Ruby versions < 1.9](https://github.com/
|
259
|
+
* [Fix default_engine check for `json` gem](https://github.com/sferik/multi_json/commit/caced0c4e8c795922a109ebc00c3c4fa8635bed8)
|
260
|
+
* [Make requirement mapper an `Array` to preserve order in Ruby versions < 1.9](https://github.com/sferik/multi_json/commit/526f5f29a42131574a088ad9bbb43d7f48439b2c)
|
257
261
|
|
258
262
|
0.0.3
|
259
263
|
-----
|
@@ -261,10 +265,8 @@
|
|
261
265
|
|
262
266
|
0.0.2
|
263
267
|
-----
|
264
|
-
|
265
268
|
* [Rename to `multi_json`](https://github.com/sferik/twitter/commit/461ab89ce071c8c9fabfc183581e0ec523788b62)
|
266
269
|
|
267
270
|
0.0.1
|
268
271
|
-----
|
269
|
-
|
270
272
|
* [Initial commit](https://github.com/sferik/twitter/commit/518c21ab299c500527491e6c049ab2229e22a805)
|
data/CONTRIBUTING.md
CHANGED
@@ -17,7 +17,7 @@ Here are some ways *you* can contribute:
|
|
17
17
|
* by closing [issues][]
|
18
18
|
* by reviewing patches
|
19
19
|
|
20
|
-
[issues]: https://github.com/
|
20
|
+
[issues]: https://github.com/sferik/multi_json/issues
|
21
21
|
|
22
22
|
## Submitting an Issue
|
23
23
|
We use the [GitHub issue tracker][issues] to track bugs and features. Before
|
data/LICENSE.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2010-
|
1
|
+
Copyright (c) 2010-2025 Michael Bleigh, Josh Kalderimis, Erik Berlin, Pavel Pravosud
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# MultiJSON
|
2
2
|
|
3
3
|
[][gem]
|
4
|
-
[][build]
|
5
|
+
[][qlty]
|
6
6
|
|
7
7
|
Lots of Ruby libraries parse JSON and everyone has their favorite JSON coder.
|
8
8
|
Instead of choosing a single JSON coder and forcing users of your library to be
|
@@ -42,33 +42,27 @@ which inherits from `ArgumentError`.
|
|
42
42
|
MultiJSON tries to have intelligent defaulting. That is, if you have any of the
|
43
43
|
supported engines already loaded, it will utilize them before attempting to
|
44
44
|
load any. When loading, libraries are ordered by speed. First Oj, then Yajl,
|
45
|
-
then the JSON gem
|
45
|
+
then the JSON gem. If no other JSON library is available,
|
46
46
|
MultiJSON falls back to [OkJson][], a simple, vendorable JSON parser.
|
47
47
|
|
48
48
|
## Supported JSON Engines
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
* [JrJackson][jrjackson] JRuby wrapper for Jackson (JRuby only)
|
57
|
-
* [OkJson][okjson] A simple, vendorable JSON parser
|
50
|
+
- [Oj][oj] Optimized JSON by Peter Ohler
|
51
|
+
- [Yajl][yajl] Yet Another JSON Library by Brian Lopez
|
52
|
+
- [JSON][json-gem] The default JSON gem with C-extensions (ships with Ruby 1.9+)
|
53
|
+
- [gson.rb][gson] A Ruby wrapper for google-gson library (JRuby only)
|
54
|
+
- [JrJackson][jrjackson] JRuby wrapper for Jackson (JRuby only)
|
55
|
+
- [OkJson][okjson] A simple, vendorable JSON parser
|
58
56
|
|
59
57
|
## Supported Ruby Versions
|
60
|
-
|
58
|
+
|
59
|
+
This library aims to support and is [tested against](https://github.com/sferik/multi_json/actions/workflows/ci.yml) the following Ruby
|
61
60
|
implementations:
|
62
61
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
* Ruby 2.2
|
68
|
-
* Ruby 2.4
|
69
|
-
* Ruby 2.5
|
70
|
-
* Ruby 2.6
|
71
|
-
* [JRuby][]
|
62
|
+
- Ruby 3.2
|
63
|
+
- Ruby 3.3
|
64
|
+
- Ruby 3.4
|
65
|
+
- [JRuby 10][jruby]
|
72
66
|
|
73
67
|
If something doesn't work in one of these implementations, it's a bug.
|
74
68
|
|
@@ -99,22 +93,21 @@ spec.add_dependency 'multi_json', '~> 1.0'
|
|
99
93
|
```
|
100
94
|
|
101
95
|
## Copyright
|
102
|
-
|
96
|
+
|
97
|
+
Copyright (c) 2010-2025 Michael Bleigh, Josh Kalderimis, Erik Berlin,
|
103
98
|
and Pavel Pravosud. See [LICENSE][] for details.
|
104
99
|
|
105
|
-
[
|
100
|
+
[build]: https://github.com/sferik/multi_json/actions/workflows/ci.yml
|
106
101
|
[gem]: https://rubygems.org/gems/multi_json
|
107
102
|
[gson]: https://github.com/avsej/gson.rb
|
108
103
|
[jrjackson]: https://github.com/guyboertje/jrjackson
|
109
104
|
[jruby]: http://www.jruby.org/
|
110
105
|
[json-gem]: https://github.com/flori/json
|
111
|
-
[json-pure]: https://github.com/flori/json
|
112
106
|
[license]: LICENSE.md
|
113
107
|
[macruby]: http://www.macruby.org/
|
114
|
-
[nsjson]: https://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html
|
115
108
|
[oj]: https://github.com/ohler55/oj
|
116
109
|
[okjson]: https://github.com/kr/okjson
|
117
110
|
[pvc]: http://docs.rubygems.org/read/chapter/16#page74
|
111
|
+
[qlty]: https://qlty.sh/gh/sferik/projects/multi_json
|
118
112
|
[semver]: http://semver.org/
|
119
|
-
[travis]: http://travis-ci.org/intridea/multi_json
|
120
113
|
[yajl]: https://github.com/brianmario/yajl-ruby
|
data/lib/multi_json/adapter.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require "singleton"
|
2
|
+
require_relative "options"
|
3
3
|
|
4
4
|
module MultiJson
|
5
5
|
class Adapter
|
@@ -7,17 +7,18 @@ module MultiJson
|
|
7
7
|
include Singleton
|
8
8
|
|
9
9
|
class << self
|
10
|
-
|
11
|
-
|
10
|
+
BLANK_RE = /\A\s*\z/
|
11
|
+
private_constant :BLANK_RE
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
def defaults(action, value)
|
14
|
+
value.freeze
|
15
|
+
define_singleton_method("default_#{action}_options") { value }
|
16
16
|
end
|
17
17
|
|
18
18
|
def load(string, options = {})
|
19
19
|
string = string.read if string.respond_to?(:read)
|
20
|
-
|
20
|
+
raise self::ParseError if blank?(string)
|
21
|
+
|
21
22
|
instance.load(string, cached_load_options(options))
|
22
23
|
end
|
23
24
|
|
@@ -25,25 +26,31 @@ module MultiJson
|
|
25
26
|
instance.dump(object, cached_dump_options(options))
|
26
27
|
end
|
27
28
|
|
28
|
-
|
29
|
+
private
|
29
30
|
|
30
31
|
def blank?(input)
|
31
|
-
input.nil? ||
|
32
|
+
input.nil? || BLANK_RE.match?(input)
|
32
33
|
rescue ArgumentError # invalid byte sequence in UTF-8
|
33
34
|
false
|
34
35
|
end
|
35
36
|
|
36
37
|
def cached_dump_options(options)
|
37
|
-
|
38
|
-
|
38
|
+
opts = options_without_adapter(options)
|
39
|
+
OptionsCache.dump.fetch(opts) do
|
40
|
+
dump_options(opts).merge(MultiJson.dump_options(opts)).merge!(opts)
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
42
44
|
def cached_load_options(options)
|
43
|
-
|
44
|
-
|
45
|
+
opts = options_without_adapter(options)
|
46
|
+
OptionsCache.load.fetch(opts) do
|
47
|
+
load_options(opts).merge(MultiJson.load_options(opts)).merge!(opts)
|
45
48
|
end
|
46
49
|
end
|
50
|
+
|
51
|
+
def options_without_adapter(options)
|
52
|
+
options[:adapter] ? options.except(:adapter) : options
|
53
|
+
end
|
47
54
|
end
|
48
55
|
end
|
49
56
|
end
|
@@ -1,15 +1,13 @@
|
|
1
1
|
module MultiJson
|
2
2
|
class AdapterError < ArgumentError
|
3
|
-
|
3
|
+
def initialize(message = nil, cause: nil)
|
4
|
+
super(message)
|
5
|
+
set_backtrace(cause.backtrace) if cause
|
6
|
+
end
|
4
7
|
|
5
8
|
def self.build(original_exception)
|
6
9
|
message = "Did not recognize your adapter specification (#{original_exception.message})."
|
7
|
-
new(message
|
8
|
-
exception.instance_eval do
|
9
|
-
@cause = original_exception
|
10
|
-
set_backtrace original_exception.backtrace
|
11
|
-
end
|
12
|
-
end
|
10
|
+
new(message, cause: original_exception)
|
13
11
|
end
|
14
12
|
end
|
15
13
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require
|
2
|
-
|
1
|
+
require "jrjackson" unless defined?(JrJackson)
|
2
|
+
require_relative "../adapter"
|
3
3
|
|
4
4
|
module MultiJson
|
5
5
|
module Adapters
|
@@ -7,7 +7,7 @@ module MultiJson
|
|
7
7
|
class JrJackson < Adapter
|
8
8
|
ParseError = ::JrJackson::ParseError
|
9
9
|
|
10
|
-
def load(string, options = {})
|
10
|
+
def load(string, options = {}) # :nodoc:
|
11
11
|
::JrJackson::Json.load(string, options)
|
12
12
|
end
|
13
13
|
|