Skip to content

flrngel/json-diet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-diet

Travis

skeletonize your json object

returns last elements type

use in node-js

npm install json-diet

usage

var diet=require("json-diet");

supports AMD

  require(["json-diet"],function(diet){
  });

wild web is support

  <script src="json-diet.js"></script>

USAGE

diet({
  "do": "doe a deer a female deer",
  "re": "a drop of golden sun",
  "me":{
    "name": "I call my self"
  },
  "fa": "a long long way to run",
  "so": {
    "needle": {
      "pulling": 0,
      "thread": "~"
    }
  },
  "la": "a note to follow sew",
  "ti": {
    "drink": {
      "with": ["jam", "bread"]
    }
  }
}).result();

USAGE RESULT

{
  do: 'string',
  re: 'string',
  me: { name: 'string' },
  fa: 'string',
  so: { needle: { pulling: 'number', thread: 'string' } },
  la: 'string',
  ti: { drink: { with: 'array' } }
}

LICENSE

MIT