Giter Club home page Giter Club logo

json-minify-rb's People

Contributors

daviscodesbugs avatar geoffyoungs avatar mattheworiordan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

json-minify-rb's Issues

Document when and why the gem is needed

Hi,

Myself, as many others, have been thinking of "why can't we have comments in JSON", because it's really useful sometimes to be able to document the rationale behind things etc.

Anyway, I started thinking about it today again, and I found this gem of yours.

But then, before I tried using it, I tried just adding a comment in my JSON data, and surprisingly, the json gem accepted it without any complaints whatsoever!

2.4.1 :007 > json_with_comment = <<EOF
2.4.1 :008"> {
2.4.1 :009">   // This is a C++-style comment
2.4.1 :010"> }
2.4.1 :011"> EOF
 => "{\n  // This is a C++-style comment\n}\n"
2.4.1 :012 > JSON.parse(json_with_comment)
 => {}

json gem version 2.1.0 in the test.

I tried uninstalling the gem, and using the built-in JSON parser in Ruby; it also swallowed this input data without further ado.

Is this something that's been added recently? Does it only work with particular versions of the JSON gem? I think it would make sense to try and document some more around this, because many people like me probably just want the data to be "parseable", and it would make sense to let them know that this can be done with the tools they already have, "given that preconditions X, Y and Z are met."

document the require

This is really minor, but a friend who's new to Ruby had some issues requiring the gem, b/c he was trying to require 'json_minify', whereas he needed to require 'json/minify'. Would be nice to include that in the example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.