keyson

Access nested json objects using simple string based paths.

Usage no npm install needed!

<script type="module">
  import keyson from 'https://cdn.skypack.dev/keyson';
</script>

README

keyson

npm Travis Coveralls David

Access nested json objects using simple string based paths.

Installation

npm install keyson

Usage

keyson(object, key [,separator]

  var obj = {
    name : 'test',
    test : [
      'hello',
      'world',
      { nested : [1, 2, 3] }
    ]
  };


  keyson(obj, 'name'); // test
  keyson(obj, 'test.0'); //hello
  keyson(obj, 'test.2.nested.2'); // 3

License

MIT (c) Svetlana Linuxenko