0.02
No commit activity in last 3 years
No release in over 3 years
Pre-parser for JSON that removes C/C++ style comments and whitespace from formatted JSON, similar to https://github.com/getify/JSON.minify.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
~> 10.1
~> 3.2

Runtime

> 0
 Project Readme

JSON::Minify

JSON.minify implementation - rationale is here: https://github.com/getify/JSON.minify

Though comments are not officially part of the JSON standard, this post from Douglas Crockford back in late 2005 helps explain the motivation behind this project.

http://tech.groups.yahoo.com/group/json/message/152

"A JSON encoder MUST NOT output comments. A JSON decoder MAY accept and ignore comments."

Credits

  • Matthew O'Riordan github.com/mattheworiordan - fix for handling empty strings (in v0.0.2)

Installation

Add this line to your application's Gemfile:

gem 'json-minify'

And then execute:

$ bundle

Or install it yourself as:

$ gem install json-minify

Usage

Require the gem with the following line:

require 'json/minify'

API is compatible with JSON.minify in the npm node-json-minify package.

JSON.minify("{ }") #=> "{}"

JSON.minify("{ /* comment */ }") #=> "{}"

Contributing

  1. Fork it ( http://github.com/geoffyoungs/json-minify-rb/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