JSON5

JSON5 parser for Ruby

Installation

Add this line to your application's Gemfile:

gem 'json5'

And then execute:

$ bundle

Or install it yourself as:

$ gem install json5

Usage

JSON5.parse("{\n    foo: 'bar',\n    while: true,\n\n    this: 'is a \\\nmulti-line string',\n\n    // this is an inline comment\n    here: 'is another', // inline comment\n\n    /* this is a block comment\n       that continues on another line */\n\n    hex: 0xDEADbeef,\n    half: .5,\n    delta: +10,\n    to: Infinity,   // and beyond!\n\n    finally: 'a trailing comma',\n    oh: [\n        \"we shouldn't forget\",\n        'arrays can have',\n        'trailing commas too',\n    ],\n}\n")

See http://json5.org/ for details

Contributing

  1. Fork it ( http://github.com/bartoszkopinski/json5/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request