Skip to content

moappi/json2json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

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.

About

javascript json parsing library; used to convert unstructured json into structured json

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published