javascript json parsing library; used to convert unstructured json into structured json
JavaScript
Switch branches/tags
Nothing to show
Latest commit 1e9d51f Aug 20, 2013 JSON2HTML Added forceArray option on get
Permalink
Failed to load latest commit information.
examples Removed Version Number Aug 20, 2013
README.md initial commit Mar 9, 2013
json2json.js Added forceArray option on get Aug 20, 2013

README.md

json2json core

What is json2json?

json2json is a javascript library used to restucture json objects.

Why json2json?

Some libraries return JSON in an format not easily usable (for example converting xml to json); this is especially so when property names may change depending on the data type involved. The purpose of json2json it to transform unstructured json into the structure that you require. Features include:

  • Regex expressions on property names
  • Variables (based on regex output)
  • Object extraction

Example

Transform

var transform = 
 {'$[var=c:(.+)Chart]':'','chart':'$(var)','stuff':'${c:$(var)Chart.needthis}'}		

Plus JSON Data

var data = 
 {'c:areaChart':{'needthis':{'propArea':'value'},'dontneedthis':{}},
  'c:pieChart':{'needthis':{'propPie':'value'},'dontneedthis':{}}}		

Output JSON Object

[{"chart":"area","stuff":{"propArea":"value"}},
 {"chart":"pie","stuff":{"propPie":"value"}}]

Need more Information?

json2json is still in a pre-beta mode (hence the 0.0.1 version) so any changes/improvements are greatly appreciated.