Skip to content

ox

911 4 7 MIT
2.14.23 (28 May 2025) Jul 01 2011 214.0 thousand (month)

Ox is a Ruby gem that provides a simple and efficient way to parse and generate XML and JSON documents. It is built on top of the underlying C library libox, which is known for its speed and low memory usage. Ox provides a simple and intuitive API for parsing and generating XML and JSON documents, and it is widely used in the Ruby ecosystem for web scraping, web development, and data-gathering applications.

One of the main features of Ox is its ability to parse and generate XML and JSON documents with low memory usage. Ox uses a pull-based parsing strategy, which allows it to parse large documents without loading the entire document into memory, thus making it more efficient than other parsing libraries. Ox also provides a fast and efficient way of generating XML and JSON documents.

Ox also provides a variety of other features that can simplify the process of working with XML and JSON documents. It can automatically handle character encodings, it can parse and generate documents with minimal memory usage, and it can validate documents against a DTD or schema.

Example Use


```ruby require 'ox'

class Sample attr_accessor :a, :b, :c

def initialize(a, b, c) @a = a @b = b @c = c end end

Create Object

obj = Sample.new(1, "bee", ['x', :y, 7.0])

Now dump the Object to an XML String.

xml = Ox.dump(obj)

Convert the object back into a Sample Object.

obj2 = Ox.parse_obj(xml) ```

Alternatives / Similar


225 4.2.0 (2021-09-09 05:37:36 ago) Aug 05 2009 compare
152 0.10.1 (2025-10-25 16:03:51 ago) Mar 19 2010 compare

Other Languages

Was this page helpful?