oj 2.0.14 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of oj might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f45b0b28345f47bc50144ccd5750143f5a3ccb0
4
- data.tar.gz: ba321d9b7543648e1b024f85a2b1257b876c414b
3
+ metadata.gz: 3a6eb31374aec1871cad89ee54750d2223cbd817
4
+ data.tar.gz: 418dcce615bc52dac68170d152c8934be5d2a68d
5
5
  SHA512:
6
- metadata.gz: 9a290c251d3bfd068add15c3f7238807efb7ea7d6321161008e11000a9492cfbb52731e18b7c29bfca57e97540d5158bc08cbacbfa1cd680c8d190bf2c6b8152
7
- data.tar.gz: b6bdfc9702edf98b18487ddea0aa5ee9502baac7dd286f7aa7033456de40cc870714920244877690b7390220a611e86b528b0fea243c31a8c8064cfc958ac942
6
+ metadata.gz: d566a85337ca2ee4df8500eb75a23c20c93ce26e74f7f57f48215f81faaf4396dce0a58ba0d40391ee32364fab2f1b171ede4c2f879f87c242bad53fd7af8242
7
+ data.tar.gz: cea71e839082f2aba82511a2a9886115496b8da839616d2f0020c5bc25eb9603825ed667a4ec6832825539a3482590a827b1a5115e226cc17f5639f8d66cae35
data/README.md CHANGED
@@ -14,60 +14,60 @@ A fast JSON parser and Object marshaller as a Ruby gem.
14
14
 
15
15
  *RubyGems* *repo*: https://rubygems.org/gems/oj
16
16
 
17
- ## <a name="follow">Follow @peterohler on Twitter</a>
18
-
19
- [Follow @peterohler on Twitter](http://twitter.com/#!/peterohler) for announcements and news about the Oj gem.
17
+ Follow [@peterohler on Twitter](http://twitter.com/#!/peterohler) for announcements and news about the Oj gem.
20
18
 
21
19
  ## <a name="build_status">Build Status</a>
22
20
 
23
21
  [![Build Status](https://secure.travis-ci.org/ohler55/oj.png?branch=master)](http://travis-ci.org/ohler55/oj)
24
22
 
25
- ## <a name="links">Links of Interest</a>
23
+ ### Current Release 2.1.0
26
24
 
27
- [Need for Speed](http://www.ohler.com/dev/need_for_speed/need_for_speed.html) for an overview of how Oj::Doc was designed.
25
+ - This version is a major rewrite of the parser. The parser now uses a constant
26
+ stack size no matter how deeply nested the JSON document is. The parser is
27
+ also slightly faster for larger documents and 30% faster for object parsing.
28
28
 
29
- *Fast XML parser and marshaller on RubyGems*: https://rubygems.org/gems/ox
29
+ - Oj.strict_load() was renamed to Oj.safe_load() to better represent its
30
+ functionality. A new Oj.strict_load() is simply Oj.load() with :mode set to
31
+ :strict.
30
32
 
31
- *Fast XML parser and marshaller on GitHub*: https://github.com/ohler55/ox
33
+ - Oj.compat_load() and Oj.object_load() added.
32
34
 
33
- ## <a name="release">Release Notes</a>
35
+ - A new Simple Callback Parser was added invoked by Oj.sc_parse().
34
36
 
35
- ### Release 2.0.14
37
+ - Eliminated :max_stack option as it is no longer needed.
36
38
 
37
- - Fixed bug in Oj::Doc.each_leaf that caused an incorrect where path to be
38
- created and also added a chack for where path maximum length.
39
+ - Handle cleanup after exceptions better.
39
40
 
40
- - Updated the documentation to note that invalid JSON documents, which includes
41
- an empty string or file, will cause an exception to be raised.
41
+ [Older release notes](http://www.ohler.com/dev/oj_misc/release_notes.html).
42
42
 
43
43
  ## <a name="description">Description</a>
44
44
 
45
- Optimized JSON (Oj), as the name implies was written to provide speed
46
- optimized JSON handling. It was designed as a faster alternative to Yajl and
47
- other the common Ruby JSON parsers. So far is has achieved that at about 2
48
- time faster than Yajl for parsing and 3 or more times faster writing JSON.
45
+ Optimized JSON (Oj), as the name implies was written to provide speed optimized
46
+ JSON handling. It was designed as a faster alternative to Yajl and other the
47
+ common Ruby JSON parsers. So far is has achieved that at about 2 time faster
48
+ than any other Ruby JSON parser and 3 or more times faster writing JSON.
49
49
 
50
50
  Oj has several dump or serialization modes which control how Objects are
51
51
  converted to JSON. These modes are set with the :mode option in either the
52
52
  default options or as one of the options to the dump() method.
53
53
 
54
- - :strict mode will only allow the 7 basic JSON types to be serialized. Any other Object
55
- will raise and Exception.
54
+ - :strict mode will only allow the 7 basic JSON types to be serialized. Any
55
+ other Object will raise and Exception.
56
56
 
57
57
  - :null mode replaces any Object that is not one of the JSON types is replaced by a JSON null.
58
58
 
59
59
  - :object mode will dump any Object as a JSON Object with keys that match the
60
- Ruby Object's variable names without the '@' character. This is the highest
61
- performance mode.
60
+ Ruby Object's variable names without the '@' character. This is the highest
61
+ performance mode.
62
62
 
63
63
  - :compat mode is is the compatible with other systems. It will serialize any
64
- Object but will check to see if the Object implements a to_hash() or to_json()
65
- method. If either exists that method is used for serializing the Object. The
66
- to_hash() is more flexible and produces more consistent output so it has a
67
- preference over the to_json() method. If neither the to_json() or to_hash()
68
- methods exist then the Oj internal Object variable encoding is used.
64
+ Object but will check to see if the Object implements a to_hash() or to_json()
65
+ method. If either exists that method is used for serializing the Object. The
66
+ to_hash() is more flexible and produces more consistent output so it has a
67
+ preference over the to_json() method. If neither the to_json() or to_hash()
68
+ methods exist then the Oj internal Object variable encoding is used.
69
69
 
70
- Oj is compatible with Ruby 1.8.7, 1.9.2, 1.9.3, JRuby, RBX, and the latest 2.0dev. Note that JRuby now disables support
70
+ Oj is compatible with Ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, JRuby, and RBX. Note that JRuby now disables support
71
71
  for extentions by default and is no longer supporting C extensions. Bugs reported in the JRuby MRI are no longer being
72
72
  fixed and there is at least one that has caused a test to be commented out for JRuby in the Oj test suite. JRuby can be
73
73
  build with extensions enabled. Check the documenation for JRuby installs in your environment.
@@ -75,14 +75,17 @@ build with extensions enabled. Check the documenation for JRuby installs in your
75
75
  Oj is also compatible with Rails. Just make sure the Oj gem is installed and
76
76
  [multi_json](https://github.com/intridea/multi_json) will pick it up and use it.
77
77
 
78
- Oj offers two alternative APIs for processing JSON. The fastest one is the Oj::Doc API. The Oj::Doc API takes a
78
+ Oj offers a few alternative APIs for processing JSON. The fastest one is the Oj::Doc API. The Oj::Doc API takes a
79
79
  completely different approach by opening a JSON document and providing calls to navigate around the JSON while it is
80
80
  open. With this approach JSON access can be well over 20 times faster than conventional JSON parsing.
81
81
 
82
- Another API, the Oj::Saj API follows an XML SAX model and walks the JSON document depth first and makes callbacks for
83
- each element. The Oj::Saj API is useful when only portions of the JSON are of interest. Performance up to 20 times
84
- faster than conventional JSON are possible. The API is simple to use but does require a different approach than the
85
- conventional parse followed by access approach used by conventional JSON parsing.
82
+ Other parsers, the Oj::Saj and the Oj::ScHandler API are callback parsers that
83
+ walk the JSON document depth first and makes callbacks for each element. Both
84
+ callback parser are useful when only portions of the JSON are of
85
+ interest. Performance up to 20 times faster than conventional JSON are
86
+ possible. The API is simple to use but does require a different approach than
87
+ the conventional parse followed by access approach used by conventional JSON
88
+ parsing.
86
89
 
87
90
  ## <a name="proper_use">Proper Use</a>
88
91
 
@@ -99,257 +102,8 @@ methods on the Objects created. As in any system, check your inputs before worki
99
102
  from a user and evaluating it is never a good idea from an unsecure source. The same is true for Object attributes as
100
103
  they are not more than Strings. Always check inputs from untrusted sources.
101
104
 
102
- ## <a name="compare">Comparisons</a>
103
-
104
- ### Fast Oj::Doc parser comparisons
105
-
106
- The fast Oj::Doc parser is compared to the Yajl and JSON::Pure parsers with
107
- strict JSON documents. No object conversions are included, just simple JSON.
108
-
109
- Since the Oj::Doc deviation from the conventional parsers comparisons of not
110
- only parsing but data access is also included. These tests use the
111
- perf_fast.rb test file. The first benchmark is for just parsing. The second is
112
- for doing a get on every leaf value in the JSON data structure. The third
113
- fetchs a value from a specific spot in the document. With Yajl and JSON this
114
- is done with a set of calls to fetch() for each level in the document. For
115
- Oj::Doc a single fetch with a path is used.
116
-
117
- The benchmark results are:
118
-
119
- > perf_fast.rb -g 1 -f
120
- --------------------------------------------------------------------------------
121
- Parse Performance
122
- Oj::Doc.parse 100000 times in 0.164 seconds or 609893.696 parse/sec.
123
- Yajl.parse 100000 times in 3.168 seconds or 31569.902 parse/sec.
124
- JSON::Ext.parse 100000 times in 3.282 seconds or 30464.826 parse/sec.
125
-
126
- Summary:
127
- System time (secs) rate (ops/sec)
128
- --------- ----------- --------------
129
- Oj::Doc 0.164 609893.696
130
- Yajl 3.168 31569.902
131
- JSON::Ext 3.282 30464.826
132
-
133
- Comparison Matrix
134
- (performance factor, 2.0 row is means twice as fast as column)
135
- Oj::Doc Yajl JSON::Ext
136
- --------- --------- --------- ---------
137
- Oj::Doc 1.00 19.32 20.02
138
- Yajl 0.05 1.00 1.04
139
- JSON::Ext 0.05 0.96 1.00
140
-
141
- --------------------------------------------------------------------------------
142
- Parse and get all values Performance
143
- Oj::Doc.parse 100000 times in 0.417 seconds or 240054.540 parse/sec.
144
- Yajl.parse 100000 times in 5.159 seconds or 19384.191 parse/sec.
145
- JSON::Ext.parse 100000 times in 5.269 seconds or 18978.638 parse/sec.
146
-
147
- Summary:
148
- System time (secs) rate (ops/sec)
149
- --------- ----------- --------------
150
- Oj::Doc 0.417 240054.540
151
- Yajl 5.159 19384.191
152
- JSON::Ext 5.269 18978.638
153
-
154
- Comparison Matrix
155
- (performance factor, 2.0 row is means twice as fast as column)
156
- Oj::Doc Yajl JSON::Ext
157
- --------- --------- --------- ---------
158
- Oj::Doc 1.00 12.38 12.65
159
- Yajl 0.08 1.00 1.02
160
- JSON::Ext 0.08 0.98 1.00
161
-
162
- --------------------------------------------------------------------------------
163
- fetch nested Performance
164
- Oj::Doc.fetch 100000 times in 0.094 seconds or 1059995.760 fetch/sec.
165
- Ruby.fetch 100000 times in 0.503 seconds or 198851.434 fetch/sec.
166
-
167
- Summary:
168
- System time (secs) rate (ops/sec)
169
- ------- ----------- --------------
170
- Oj::Doc 0.094 1059995.760
171
- Ruby 0.503 198851.434
172
-
173
- Comparison Matrix
174
- (performance factor, 2.0 row is means twice as fast as column)
175
- Oj::Doc Ruby
176
- ------- ------- -------
177
- Oj::Doc 1.00 5.33
178
- Ruby 0.19 1.00
179
-
180
- What the results mean are that for getting just a few values from a JSON
181
- document Oj::Doc is 20 times faster than any other parser and for accessing
182
- all values it is still over 12 times faster than any other Ruby JSON parser.
183
-
184
- ### Conventional Oj parser comparisons
185
-
186
- The following table shows the difference is speeds between several
187
- serialization packages compared to the more conventional Oj parser. The tests
188
- had to be scaled back due to limitation of some of the gems. I finally gave up
189
- trying to get JSON Pure to serialize without errors with Ruby 1.9.3. It had
190
- internal errors on anything other than a simple JSON structure. The errors
191
- encountered were:
192
-
193
- - MessagePack fails to convert Bignum to JSON
194
-
195
- - JSON Pure fails to serialize any numbers or Objects with the to_json() method
196
-
197
- Options were added to the test/perf_strict.rb test to run the test without
198
- Object encoding and without Bignums.
199
-
200
- None of the packages except Oj were able to serialize Ruby Objects that did
201
- not have a to_json() method or were of the 7 native JSON types.
202
-
203
- A perf_obj.rb file was added for comparing different Object marshalling
204
- packages.
205
-
206
- It is also worth noting that although Oj is slightly behind MessagePack for
207
- parsing, Oj serialization is much faster than MessagePack even though Oj uses
208
- human readable JSON vs the binary MessagePack format.
209
-
210
- Oj supports circular references when in :object mode and when the :circular
211
- flag is true. None of the other gems tested supported circular
212
- references. They failed in the following manners when the input included
213
- circular references.
214
-
215
- - Yajl core dumps Ruby
216
-
217
- - JSON fails and raises an Exception
218
-
219
- - MessagePack fails and raises an Exception
220
-
221
- The benchmark results are:
222
-
223
- with Object and Bignum encoding:
105
+ ## <a name="release">Release Notes</a>
224
106
 
225
- > perf_strict.rb
226
- --------------------------------------------------------------------------------
227
- Load/Parse Performance
228
- Oj:compat.load 100000 times in 1.481 seconds or 67513.146 load/sec.
229
- Oj.load 100000 times in 1.066 seconds or 93796.400 load/sec.
230
- JSON::Ext.parse 100000 times in 3.023 seconds or 33074.875 parse/sec.
231
- JSON::Pure.parse 100000 times in 18.908 seconds or 5288.799 parse/sec.
232
- Ox.load 100000 times in 1.240 seconds or 80671.900 load/sec.
233
-
234
- Summary:
235
- System time (secs) rate (ops/sec)
236
- ---------- ----------- --------------
237
- Oj 1.066 93796.400
238
- Ox 1.240 80671.900
239
- Oj:compat 1.481 67513.146
240
- JSON::Ext 3.023 33074.875
241
- JSON::Pure 18.908 5288.799
242
-
243
- Comparison Matrix
244
- (performance factor, 2.0 row is means twice as fast as column)
245
- Oj Ox Oj:compat JSON::Ext JSON::Pure
246
- ---------- ---------- ---------- ---------- ---------- ----------
247
- Oj 1.00 1.16 1.39 2.84 17.73
248
- Ox 0.86 1.00 1.19 2.44 15.25
249
- Oj:compat 0.72 0.84 1.00 2.04 12.77
250
- JSON::Ext 0.35 0.41 0.49 1.00 6.25
251
- JSON::Pure 0.06 0.07 0.08 0.16 1.00
252
-
253
-
254
- --------------------------------------------------------------------------------
255
- Dump/Encode/Generate Performance
256
- Oj:compat.dump 100000 times in 0.789 seconds or 126715.249 dump/sec.
257
- Oj.dump 100000 times in 0.457 seconds or 218798.751 dump/sec.
258
- JSON::Ext.generate 100000 times in 4.371 seconds or 22878.630 generate/sec.
259
- Ox.dump 100000 times in 0.501 seconds or 199425.256 dump/sec.
260
-
261
- Summary:
262
- System time (secs) rate (ops/sec)
263
- --------- ----------- --------------
264
- Oj 0.457 218798.751
265
- Ox 0.501 199425.256
266
- Oj:compat 0.789 126715.249
267
- JSON::Ext 4.371 22878.630
268
-
269
- Comparison Matrix
270
- (performance factor, 2.0 row is means twice as fast as column)
271
- Oj Ox Oj:compat JSON::Ext
272
- --------- --------- --------- --------- ---------
273
- Oj 1.00 1.10 1.73 9.56
274
- Ox 0.91 1.00 1.57 8.72
275
- Oj:compat 0.58 0.64 1.00 5.54
276
- JSON::Ext 0.10 0.11 0.18 1.00
277
-
278
-
279
- The following packages were not included for the reason listed
280
- ***** MessagePack: RangeError: bignum too big to convert into `unsigned long long'
281
- ***** Yajl: RuntimeError: Yajl parse and encode did not return the same object as the original.
282
- ***** JSON::Pure: TypeError: wrong argument type JSON::Pure::Generator::State (expected Data)
283
-
284
- without Objects or numbers (for JSON Pure, Yajl, and Messagepack) JSON:
285
-
286
- --------------------------------------------------------------------------------
287
- Load/Parse Performance
288
- Oj:compat.load 100000 times in 0.806 seconds or 124051.164 load/sec.
289
- Oj.load 100000 times in 0.810 seconds or 123384.587 load/sec.
290
- Yajl.parse 100000 times in 1.441 seconds or 69385.996 parse/sec.
291
- JSON::Ext.parse 100000 times in 1.567 seconds or 63797.848 parse/sec.
292
- JSON::Pure.parse 100000 times in 13.500 seconds or 7407.247 parse/sec.
293
- Ox.load 100000 times in 0.954 seconds or 104836.748 load/sec.
294
- MessagePack.unpack 100000 times in 0.651 seconds or 153707.817 unpack/sec.
295
-
296
- Summary:
297
- System time (secs) rate (ops/sec)
298
- ----------- ----------- --------------
299
- MessagePack 0.651 153707.817
300
- Oj:compat 0.806 124051.164
301
- Oj 0.810 123384.587
302
- Ox 0.954 104836.748
303
- Yajl 1.441 69385.996
304
- JSON::Ext 1.567 63797.848
305
- JSON::Pure 13.500 7407.247
306
-
307
- Comparison Matrix
308
- (performance factor, 2.0 row is means twice as fast as column)
309
- MessagePack Oj:compat Oj Ox Yajl JSON::Ext JSON::Pure
310
- ----------- ----------- ----------- ----------- ----------- ----------- ----------- -----------
311
- MessagePack 1.00 1.24 1.25 1.47 2.22 2.41 20.75
312
- Oj:compat 0.81 1.00 1.01 1.18 1.79 1.94 16.75
313
- Oj 0.80 0.99 1.00 1.18 1.78 1.93 16.66
314
- Ox 0.68 0.85 0.85 1.00 1.51 1.64 14.15
315
- Yajl 0.45 0.56 0.56 0.66 1.00 1.09 9.37
316
- JSON::Ext 0.42 0.51 0.52 0.61 0.92 1.00 8.61
317
- JSON::Pure 0.05 0.06 0.06 0.07 0.11 0.12 1.00
318
-
319
-
320
- --------------------------------------------------------------------------------
321
- Dump/Encode/Generate Performance
322
- Oj:compat.dump 100000 times in 0.173 seconds or 578526.262 dump/sec.
323
- Oj.dump 100000 times in 0.179 seconds or 558362.880 dump/sec.
324
- Yajl.encode 100000 times in 0.776 seconds or 128794.279 encode/sec.
325
- JSON::Ext.generate 100000 times in 3.511 seconds or 28483.812 generate/sec.
326
- JSON::Pure.generate 100000 times in 7.389 seconds or 13533.717 generate/sec.
327
- Ox.dump 100000 times in 0.196 seconds or 510589.629 dump/sec.
328
- MessagePack.pack 100000 times in 0.317 seconds or 315307.220 pack/sec.
329
-
330
- Summary:
331
- System time (secs) rate (ops/sec)
332
- ----------- ----------- --------------
333
- Oj:compat 0.173 578526.262
334
- Oj 0.179 558362.880
335
- Ox 0.196 510589.629
336
- MessagePack 0.317 315307.220
337
- Yajl 0.776 128794.279
338
- JSON::Ext 3.511 28483.812
339
- JSON::Pure 7.389 13533.717
340
-
341
- Comparison Matrix
342
- (performance factor, 2.0 row is means twice as fast as column)
343
- Oj:compat Oj Ox MessagePack Yajl JSON::Ext JSON::Pure
344
- ----------- ----------- ----------- ----------- ----------- ----------- ----------- -----------
345
- Oj:compat 1.00 1.04 1.13 1.83 4.49 20.31 42.75
346
- Oj 0.97 1.00 1.09 1.77 4.34 19.60 41.26
347
- Ox 0.88 0.91 1.00 1.62 3.96 17.93 37.73
348
- MessagePack 0.55 0.56 0.62 1.00 2.45 11.07 23.30
349
- Yajl 0.22 0.23 0.25 0.41 1.00 4.52 9.52
350
- JSON::Ext 0.05 0.05 0.06 0.09 0.22 1.00 2.10
351
- JSON::Pure 0.02 0.02 0.03 0.04 0.11 0.48 1.00
352
-
353
107
  ### Simple JSON Writing and Parsing:
354
108
 
355
109
  ```ruby
@@ -372,66 +126,27 @@ puts "Same? #{h == h2}"
372
126
  # true
373
127
  ```
374
128
 
375
- ### Object JSON format:
376
-
377
- In :object mode Oj generates JSON that follows conventions which allow Class
378
- and other information such as Object IDs for circular reference detection. The
379
- formating follows the following rules.
129
+ # Links
380
130
 
381
- 1. JSON native types, true, false, nil, String, Hash, Array, and Number are
382
- encoded normally.
131
+ ## <a name="links">Performance Comparisons</a>
383
132
 
384
- 2. A Symbol is encoded as a JSON string with a preceeding `:` character.
133
+ [Oj Strict Mode Performance](http://www.ohler.com/dev/oj_misc/performance_strict.html) compares Oj strict mode parser performance to other JSON parsers.
385
134
 
386
- 3. The `^` character denotes a special key value when in a JSON Object sequence.
135
+ [Oj Compat Mode Performance](http://www.ohler.com/dev/oj_misc/performance_compat.html) compares Oj compat mode parser performance to other JSON parsers.
387
136
 
388
- 4. A Ruby String that starts with `:` or the sequence `^i` or `^r` are encoded by
389
- excaping the first character so that it appears as `\u005e` or `\u003a` instead of
390
- `:` or `^`.
137
+ [Oj Object Mode Performance](http://www.ohler.com/dev/oj_misc/performance_object.html) compares Oj object mode parser performance to other marshallers.
391
138
 
392
- 5. A `"^c"` JSON Object key indicates the value should be converted to a Ruby
393
- class. The sequence `{"^c":"Oj::Bag"}` is read as the Oj::Bag class.
139
+ [Oj Callback Performance](http://www.ohler.com/dev/oj_misc/performance_callback.html) compares Oj callback parser performance to other JSON parsers.
394
140
 
395
- 6. A `"^t"` JSON Object key indicates the value should be converted to a Ruby
396
- Time. The sequence `{"^t":1325775487.000000}` is read as Jan 5, 2012 at
397
- 23:58:07.
398
-
399
- 7. A `"^o"` JSON Object key indicates the value should be converted to a Ruby
400
- Object. The first entry in the JSON Object must be a class with the `"^o"`
401
- key. After that each entry is treated as a variable of the Object where the
402
- key is the variable name without the preceeding `@`. An example is
403
- `{"^o":"Oj::Bag","x":58,"y":"marbles"}`. `"^O"` is the same except that it is
404
- for built in or odd classes that don't obey the normal Ruby rules. Examples
405
- are Rational, Date, and DateTime.
406
-
407
- 8. A `"^u"` JSON Object key indicates the value should be converted to a Ruby
408
- Struct. The first entry in the JSON Object must be a class with the `"^u"`
409
- key. After that each entry is is given a numeric position in the struct and
410
- that is used as the key in the JSON Object. An example is `{"^u":["Range",1,7,false]}`.
411
-
412
- 9. When encoding an Object, if the variable name does not begin with an `@`
413
- character then the name preceeded by a `~` character. This occurs in the
414
- Exception class. An example is `{"^o":"StandardError","~mesg":"A Message","~bt":[".\/tests.rb:345:in `test_exception'"]}`.
141
+ ## <a name="links">Links of Interest</a>
415
142
 
416
- 10. If a Hash entry has a key that is not a String or Symbol then the entry is
417
- encoded with a key of the form `"^#n"` where n is a hex number. The value that
418
- is an Array where the first element is the key in the Hash and the second is
419
- the value. An example is `{"^#3":[2,5]}`.
143
+ *Fast XML parser and marshaller on RubyGems*: https://rubygems.org/gems/ox
420
144
 
421
- 11. A `"^i"` JSON entry in either an Object or Array is the ID of the Ruby
422
- Object being encoded. It is used when the :circular flag is set. It can appear
423
- in either a JSON Object or in a JSON Array. In an Object the `"^i"` key has a
424
- corresponding reference Fixnum. In an array the sequence will include an
425
- embedded reference number. An example is
426
- `{"^o":"Oj::Bag","^i":1,"x":["^i2",true],"me":"^r1"}`.
145
+ *Fast XML parser and marshaller on GitHub*: https://github.com/ohler55/ox
427
146
 
428
- 12. A `"^r"` JSON entry in an Object is a references to a Object or Array that
429
- already appears in the JSON String. It must match up with a previous `"^i"`
430
- ID. An example is `{"^o":"Oj::Bag","^i":1,"x":3,"me":"^r1"}`.
147
+ [Oj Object Encoding Format](http://www.ohler.com/dev/oj_misc/encoding_format.html) describes the OJ Object JSON encoding format.
431
148
 
432
- 13. If an Array element is a String and starts with `"^i"` then the first
433
- character, the `^` is encoded as a hex character sequence. An example is
434
- `["\u005ei37",3]`.
149
+ [Need for Speed](http://www.ohler.com/dev/need_for_speed/need_for_speed.html) for an overview of how Oj::Doc was designed.
435
150
 
436
151
  ### License:
437
152