Skip to content

Latest commit

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

author

Arwid Bancewicz arwid.ca

version

0.1

updated

31 Aug 2011

dependencies

Underscore.js (tested with 1.1.7)

JSON_Minifier minifies a JSON array of Objects. Its motivation is to reduce the bandwidth of JSON Web Services. See arwid.github.com/JSON_Minifier for an example which reduces a simple JSON by 50%.

Use _.JSON_minify to minify a JSONString or JSONObject and _.JSON_revert to revert it back to original.

minified = _.JSON_minify([{ "firstName":"John" , "lastName":"Doe" , "age":23 }])
reverted = _.JSON_revert(minified)

As a very simple example, the following JSON

[
{ "firstName":"John" , "lastName":"Doe" , "age":23 },
{ "firstName":"Mary" , "lastName":"Smirth", "age":32 },
{ "firstName":"Sally", "lastName":"Green" , "age":27 },
{ "firstName":"Jim" , "lastName":"Galley", "age":41 }
]

…reduces to

{
"data": [["John","Doe",23],["Mary","Smirth",32],["Sally","Green",27],["Jim","Galley",41]],
"map" : ["firstName","lastName","age"]
}
  • Add support for more complicated JSONs. A mapping could possibly look like this:

    "map" : {"name":"[0]","address":"[1]","postalCode":"[1][0]","city":[1][1]"}

  • Extend api.jquery.com/jQuery.ajax/ by offering ‘jsonm’ as a datatype.

  • Create a ruby gem

JSON_Minifier is covered by the MIT License.

About

Minify/Compress your JSON, simple as that.

Resources

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages