Oj Release Note Archive

peter@ohler.com

Author: Peter Ohler Published: May 1, 2014

Release 2.9.9 [July 7, 2014]

  • Missed a character map entry. / in ascii mode is now output as / and not \/
  • Fixed SC parser to not treat all IO that respond to fileno as a file. It not checks stat and asks if it is a file.
  • Tightened object parsing of non-string hash keys so that just "^#x" is parsed as a hash pair and not "~#x".
  • Using echo to STDIN as an IO input works around the exception raised when asking the IO for it's position (IO.pos).
  • Simple Callback Parser now uses the new stream parser for handling files and IO so that larger files are handled more efficiently and streams are read as data arrives instead of on close.
  • Handles file FIFO pipes correctly now.

Release 2.9.8 [June 25, 2014]

  • Changed escaping back to previous release and added a new escape mode.
  • Strict mode and compat mode no longer parse Infinity or NaN as a valid number. Both are valid in object mode still.

Release 2.9.7 [June 24, 2014]

  • Changed dump to use raw / and raw \n in output instead of escaping.
  • Changed the writer to always put a new line at the end of a top level JSON object. It makes output easier to view and edit with minimal impact on size.
  • Worked around the file.gets look ahead caching as long as it is not called while parsing (of course).
  • Thanks to lautis for a new parse option. quirks_mode allows Oj to behave quirky like the JSON gem. Actually the JSON gem has it backwards with quirky mode supporting the JSON spec and non-quirky limiting parsing to objects and arrays. Oj stays consistent with the JSON gem to avoid confusion.
  • Fixed problem with sc_parse not terminating the string when loaded from a file.
  • Thanks go to dchelimsky for expanding the code sample for the ScHandler.

Release 2.9.6 [June 15, 2014]

  • Fixed bug using StringIO with SCParser.
  • Tightened up JSON mimic to raise an exception if JSON.parse is called on a JSON documents that returns a primitive type.

Release 2.9.5 [June 7, 2014]

  • Mimic mode now monkey patches Object like JSON.
  • A big thanks to krasnoukhov for reorganizing test and helping get Oj more rails compatible.
  • Another thanks goes out to lautis for a pull request that provided some optimization and fixed the return exception for an embedded null in a string.
  • Fixed a bug with zip reader streams where EOF was not handled nicely.

Release 2.9.4 [May 28, 2014]

  • In mimic mode parse errors now match the JSON::ParserError.

Release 2.9.3 [May 15, 2014]

  • Fixed IO read error that showed up in IO objects that return nil instead of raising an EOF error when read is done.

Release 2.9.2 [May 14, 2014]

  • Fixed link error with Windows.

Release 2.9.1 [May 14, 2014]

  • Fixed mimic load when given a block to evalate. It conflicted with the new load option.
  • Added a true stream that is used when the input argument to load is an IO object such as a stream or file. This is slightly slower for smaller files but allows reading of huge files that will not fit in memory and is more efficient on even larger files that would fit into memory. The load_file() method uses the new stream parser so multiple GB files can be processed without used execessive memory.

Release 2.9.0 [May 1, 2014]

  • Added support for detection and handling of Strng, Array, and Hash subclasses.
  • Oj.load() can now take a block which will be yielded to on every object parsed when used with a file or string with multiple JSON entries.

Release 2.8.1 [April 21, 2014]

  • Added additional argument to the register_odd function.
  • Fixed bug that failed to load on some uses of STDIN.

Release 2.8.0 [April 20, 2014]

  • Added support for registering special encoding and decoding rules for specific classes. This the ActiveSupport subclass of the String class for safe strings. For an example look at the `test_object.rb` file, `test_odd_string` test.

Release 2.7.3 [April 11, 2014]

  • Fixed bug where load and dump of Structs in modules did not work correctly.

Release 2.7.2 [April 6, 2014]

  • Added option return nil if nil is provided as input to load.

Release 2.7.1 [March 30, 2014]

  • Fixed bug in new push_key which caused duplicate characters.

Release 2.7.0 [March 29, 2014]

  • Added the push_key() method to the StringWriter and StreamWriter classes.

Release 2.6.1 [March 21, 2014]

  • Set a limit on the maximum nesting depth to 1000. An exception is raised instead of a segfault unless a reduced stack is used which could trigger the segfault due to an out of memory condition.

Release 2.6.0 [March 11, 2014]

  • Added the :use_to_json option for Oj.dump(). If this option is set to false the to_json() method on objects will not be called when dumping. This is the default behavior. The reason behind the option and change is to better support Rails and ActiveSupport. Previous works arounds have been removed.

Release 2.5.5 [February 18, 2014]

  • Worked around the Rubinius failure to load bigdecimal from a require within the C code.

Release 2.5.4 [January 14, 2014]

  • Fixed bug where unterminated JSON did not raise an exception.

Release 2.5.3 [January 3, 2014]

  • Added support for blocks with StringWriter.

Release 2.5.2 [January 2, 2014]

  • Fixed indent problem with StringWriter so it now indents properly.

Release 2.5.1 [December 18, 2013]

  • Added push_json() to the StringWriter and StreamWriter to allow raw JSON to be added to a JSON document being constructed.

Release 2.4.3 [December 16, 2013]

  • Made include pthread.h conditional for Windows.

Release 2.4.2 [December 14, 2013]

  • Thanks to Patrik Rak for a fix to a buffer short copy when dumping with 0 indent.

Release 2.4.1 [December 10, 2013]

  • Fixed Windows version by removing class cache test.

Release 2.4.0 [December 8, 2013]

  • Merged in a PR to again allow strings with embedded nulls.
  • Implemented StreamWriter to compliment the StringWriter.
  • Fixed bug in the class cache hash function that showed up with the sparc compiler.

Release 2.3.0 [December 1, 2013]

  • JRuby is no longer supported.
  • Thanks to Stefan Kaes the support for structs has been optimized.
  • Better support for Rubinous.
  • Added option to disable GG during parsing.
  • Added StringWriter that allows building a JSON document one element at a time.

Release 2.2.3 [November 19, 2013]

  • Fixed struct segfault on load.
  • Added option to force float on load if a decimal number.

Release 2.2.2 [November 17, 2013]

  • Added mutex support for Windows.
  • Protected SCP parser for GC.

Release 2.2.1 [November 15, 2013]

  • Made all VALUEs in parse volatile to avoid garbage collection while in use.

Release 2.2.0 [November 11, 2013]

  • All 1.8.x versions of Ruby now have require 'rational' called.
  • Removed the temporary GC disable and implemented mark strategy instead.
  • Added new character encoding mode to support the Rails 4 escape characters of &, <, and > as xss_safe mode. The :encoding option replaces the :ascii_only option.
  • Change parsing of NaN to not use math.h which on older systems does not define NAN.

Release 2.1.8 [October 28, 2013]

  • All 1.8.x versions of Ruby now have require 'rational' called.
  • Removed the temporary GC disable and implemented mark strategy instead.

Release 2.1.7 [October 19, 2013]

  • Added support for NaN and -NaN to address issue #102. This is not according to the JSON spec but seems to be expected.
  • Added require for rational if the Ruby version is 1.8.7 to address issue #104.
  • Added Rails re-call of Oj.dump in the to_json() method which caused loops with Rational objects to fix issue #108 and #105.

Release 2.1.6 [October 7, 2013]

  • Added Oj.to_stream() for dumping JSON to an IO object.

Release 2.1.5 [July 21, 2013]

  • Allow exception dumping magic with Windows.

Release 2.1.4 [July 4, 2013]

  • Fixed Linux 32 bit rounding bug.

Release 2.1.3 [June 30, 2013]

  • Fixed bug that did not deserialize all attributes in an Exception subclass.
  • Added a sample to demonstrate how to write Exception subclasses that will automatically serialize and deserialize.

Release 2.1.2 [June 19, 2013]

  • Fixed support for Windows.

Release 2.1.1 [June 17, 2013]

  • Fixed off by 1 error in buffer for escaped strings.

Release 2.1.0 [June 16, 2013]

  • This version is a major rewrite of the parser. The parser now uses a constant stack size no matter how deeply nested the JSON document is. The parser is also slightly faster for larger documents and 30% faster for object parsing.
  • Oj.strict_load() was renamed to Oj.safe_load() to better represent its functionality. A new Oj.strict_load() is simply Oj.load() with :mode set to :strict.
  • Oj.compat_load() and Oj.object_load() added.
  • A new Simple Callback Parser was added invoked by Oj.sc_parse().
  • Eliminated :max_stack option as it is no longer needed.
  • Handle cleanup after exceptions better.


Release 2.0.14 [May 26, 2013]

  • Fixed bug in Oj::Doc.each_leaf that caused an incorrect where path to be created and also added a check for where path maximum length.
  • Updated the documentation to note that invalid JSON documents, which includes an empty string or file, will cause an exception to be raised.


Release 2.0.13 [May 17, 2013]

  • Changed dump to put closing array brackets and closing object curlies on the line following the last element if :indent is set to greater than zero.


Release 2.0.12 [April 28, 2013]

  • Another fix for mimic.
  • mimic_JSON now can now be called after loading the json gem. This will replace the json gem methods after loading. This may be more compatible in many cases.


Release 2.0.11 [April 23, 2013]

  • Fixed mimic issue with Debian
  • Added option to not cache classes when loading. This should be used when classes are dynamically unloaded and the redefined.
  • Float rounding improved by limiting decimal places to 15 places.
  • Fixed xml time dumping test.


Release 2.0.10 [March 10, 2013]

  • Tweaked dump calls by reducing preallocation. Speeds are now several times faster for smaller objects.
  • Fixed Windows compile error with Ruby 2.0.0.


Release 2.0.9 [March 4, 2013]

  • Fixed problem with INFINITY with CentOS and Ruby 2.0.0. There are some header file conflicts so a different INFINITY was used.


Release 2.0.8 [March 1, 2013]

  • Added :bigdecimal_load option that forces all decimals in a JSON string to be read as BigDecimals instead of as Floats. This is useful if precision is important.
  • Worked around bug in active_support 2.3.x where BigDecimal.as_json() returned self instead of a JSON primitive. Of course that creates a loop and blows the stack. Oj ignores the as_json() for any object that returns itself and instead encodes the object as it sees fit which is usually what is expected.
  • All tests pass with Ruby 2.0.0-p0. Had to modify Exception encoding slightly.


Release 2.0.7 [February 18, 2013]

  • Fixed bug where undefined classes specified in a JSON document would freeze Ruby instead of raising an exception when the auto_define option was not set. (It seems that Ruby freezes on trying to add variables to nil.)


Release 2.0.6 [February 18, 2013]

  • Worked around an undocumented feature in linux when using make that misreports the stack limits.


Release 2.0.5 [February 16, 2013]

  • DateTimes are now output the same in compat mode for both 1.8.7 and 1.9.3 even though they are implemented differently in each Ruby.
  • Objects implemented as data structs can now change the encoding by implemented either to_json(), as_json(), or to_hash().
  • Added an option to allow BigDecimals to be dumped as either a string or as a number. There was no agreement on which was the best or correct so both are possible with the correct option setting.


Release 2.0.4 [February 11, 2013]

  • Fixed bug related to long class names.
  • Change the default for the auto_define option.
  • Added Oj.strict_load() method that sets the options to public safe options. This should be safe for loading JSON documents from a public unverified source. It does not eleviate to need for reasonable programming practices of course. See the section on the proper use of Oj in a public exposure.


Release 2.0.3 [February 3, 2013]

  • Fixed round off error in time format when rounding up to the next second.


Release 2.0.2 [January 23, 2013]

  • Fixed bug in Oj.load where loading a hash with symbold keys and also turning on symbolize keys would try to symbolize a symbol.


Release 2.0.1 [January 15, 2013]

  • BigDecimals now dump to a string in compat mode thanks to cgriego.
  • High precision time (nano time) can be turned off for better compatibility with other JSON parsers.
  • Times before 1970 now encode correctly.


Release 2.0.0 [December 18, 2012]

  • Thanks to yuki24 Floats are now output with a decimal even if they are an integer value.
  • The Simple API for JSON (SAJ) API has been added. Read more about it on the Oj::Saj page.


Release 1.4.7 [December 9, 2012]

  • In compat mode non-String keys are converted to Strings instead of raising and error. (issue #52)


Release 1.4.6 [December 3, 2012]

  • Silently ignores BOM on files and Strings.
  • Now works with JRuby 1.7.0 to the extent possible with the unsupported C extension in JRuby.


Release 1.4.5 [November 19, 2012]

  • Adds the old deprecated methods of unparse(), fast_unparse(), and pretty_unparse() to JSON_mimic.


Release 1.4.4 [November 7, 2012]

  • Fixed bug in mimic that missed mimicing json_pure.


Release 1.4.3 [October 19, 2012]

  • Fixed Exception encoding in Windows version.


Release 1.4.2 [October 17, 2012]

  • Fixed dump and load of BigDecimals in :object mode.
  • BigDecimals are now dumped and loaded in all modes.


Release 1.4.1 [October 17, 2012]

  • Windows RubyInstaller and TCS-Ruby now supported thanks to Jarmo Pertman. Thanks Jarmo.


Release 1.4.0 [October 11, 2012]

  • Parse errors now raise an Exception that inherites form Oj::Error which inherits from StandardError. Some other Exceptions were changed as well to make it easier to rescue errors.


Release 1.3.7 [October 5, 2012]

  • Added header file for linux builds.


Release 1.3.6 [October 4, 2012]

  • Oj.load() now raises a SystemStackError if a JSON is too deeply nested. The loading is allowed to use on 75% of the stack.
  • Oj::Doc.open() now raises a SystemStackError if a JSON is too deeply nested. The loading is allowed to use on 75% of the stack. Oj::Doc.open will allow much deeper nesting than Oj.load().


Release 1.3.5 [September 25, 2012]

  • Fixed mimic_JSON so it convinces Ruby that the ALL versions of the json gem are already loaded.


Release 1.3.4 [August 12, 2012]

  • Fixed mimic_JSON so it convinces Ruby that the json gem is already loaded.


Release 1.3.2 [July 28, 2012]

  • Fixed compile problems with native Ruby on OS X 10.8 (Mountain Lion)


Release 1.3.1 [July 2012]

  • Fixed time zone issue with :xmlschema date format.


Release 1.3.0 [July 9, 2012]

  • extconf.rb fixed to not pause on some OSs when checking CentOS special case.
  • Added an option to control the time format output when in :compat mode.


Release 1.2.13 [July 8, 2012]

  • Fixed double free bug in Oj::Doc that showed up for larger documents.


Release 1.2.12 [July 6, 2012]

  • Fixed GC bug in Oj::Doc, the fast parser.
  • Serialization of Exceptions in Ruby 1.8.7 now includes message and backtrace.


Release 1.2.11 [June 21, 2012]

  • Added :max_stack option to limit the size of string allocated on the stack.


Release 1.2.10 [June 20, 2012]

  • Added check for circular on loading of circular dumped JSON.
  • Added support for direct serialization of BigDecimal, Rational, Date, and DateTime.
  • Added json.rb to $" in mimic mode to avoid pulling in the real JSON by accident.
  • Oj is now thread safe for all functions.
  • The / (solidus) character is now placed in strings without being escaped.


Release 1.2.9 [May 29, 2012]


Release 1.2.8 [May 3, 2012]

  • Included a contribution by nevans to fix a math.h issue with an old fedora linux machine.
  • Included a fix to the documentation found by mat.


Release 1.2.7 [April 22, 2012]

  • Fixed bug where a float with too many characters would generate an error. It is not parsed as accuractly as Ruby will support.
  • Cleaned up documentation errors.
  • Added support for OS X Ruby 1.8.7.


Release 1.2.6 [April 22, 2012]

  • Cleaned up documentation errors.
  • Added support for OS X Ruby 1.8.7.


Release 1.2.5 [April 18, 2012]

  • Added support for create_id in Oj and in mimic_JSON mode


Release 1.2.4 [April 13, 2012]

  • Removed all use of math.h to get around CentOS 5.4 compile problem.


Release 1.2.3 [April 9, 2012]

  • Fixed compile error for the latest RBX on Travis.


Release 1.2.2 [April 2, 2012]

  • minor bug fixes for different rubies along with test updates
  • Oj::Doc will now automatically close on GC.


Release 1.2.1 [March 30, 2012]

  • Organized compile configuration better.
  • as_json() support now more flexible thanks to a contribution by sauliusg.


Release 1.2.0 [March 30, 2012]

  • Removed the encoding option and fixed a misunderstanding of the string encoding. Unicode code points are now used instead of byte codes. This is not compatible with previous releases but is compliant with RFC4627.
  • Time encoding in :object mode is faster and higher nanosecond precision.


Release 1.1.1 [March 27, 2012]

  • The encoding option can now be an Encoding Object or a String.
  • Fixed Rubinius errors.


Release 1.1.0 [March 27, 2012]

  • Errors are not longer raised when comments are encountered in JSON documents.
  • Oj can now mimic JSON. With some expections calling JSON.mimic_JSON will allow all JSON calls to use OJ instead of JSON. This gives a speedup of more than 2x on parsing and 5x for generating over the JSON::Ext module.
  • Oj::Doc now allows a document to be left open and then closed with the Oj::Doc.close() class.
  • Changed the default encoding to UTF-8 instead of the Ruby default String encoding.


Release 1.0.6 [March 20, 2012]

  • Gave Oj::Doc a speed increase. It is now 8 times fast than JSON::Ext.


Release 1.0.5 [March 17, 2012]

  • Added :ascii_only options for dumping JSON where all high-bit characters are encoded as escaped sequences.


Release 1.0.4 [March 16, 2012]

  • Fixed bug that did not allow symbols as keys in :compat mode.


Release 1.0.3 [March 15, 2012]

  • Added :symbol_keys option to convert String hash keys into Symbols.
  • The load() method now supports IO Objects as input as well as Strings.


Release 1.0.2 [March 15, 2012]

  • Added RSTRING_NOT_MODIFIED for Rubinius optimization.


Release 1.0.1 [March 15, 2012]

  • Fixed compatibility problems with Ruby 1.8.7.


Release 1.0.0 [March 13, 2012]

  • The screaming fast Oj::Doc parser added.


Release 0.9.0 [March 5, 2012]

  • Added support for circular references.


Release 0.8.0 [February 27, 2012]

  • Auto creation of data classes when unmarshalling Objects if the Class is not defined


Release 0.7.0 [February 26, 2012]

  • changed the object JSON format
  • serialized Ruby Objects can now be deserialized
  • improved performance testing


Release 0.6.0 [February 22, 2012]

  • supports arbitrary Object dumping/serialization
  • to_hash() method called if the Object responds to to_hash and the result is converted to JSON
  • to_json() method called if the Object responds to to_json
  • almost any Object can be dumped, including Exceptions (not including Thread, Mutex and Objects that only make sense within a process)
  • default options have been added


Release 0.5.2 [February 19, 2012]

  • Release 0.5.2 fixes encoding and float encoding.
  • This is the first release sith a version of 0.5 indicating it is only half done. Basic load() and dump() is supported for Hash, Array, NilClass, TrueClass, FalseClass, Fixnum, Float, Symbol, and String Objects.


Release 0.5.1 [February 19, 2012]


Release 0.5 [February 19, 2012]

  • This is the first release with a version of 0.5 indicating it is only half done. Basic load() and dump() is supported for Hash, Array, NilClass, TrueClass, FalseClass, Fixnum, Float, Symbol, and String Objects.