Skip to content

Joshsteverson/json-data-paths

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON DATA PATHS

Easily extract complete paths to every property in an object.

Created for use with Simple Object Path

const jsonDataPaths = require('./index')
const obj = {animal:
  {
      type: 'Feline',
      dailyNeeds: [
          {timeOfDay: 'morning', need: 'Breakfast'},
          {timeOfDay: 'evening', need: 'Dinner'}
      ]
  }
}

const paths = jsonDataPaths(obj)
/*
[ 'animal',
  'animal/type',
  'animal/dailyNeeds',
  'animal/dailyNeeds/0',
  'animal/dailyNeeds/0/timeOfDay',
  'animal/dailyNeeds/0/need',
  'animal/dailyNeeds/1',
  'animal/dailyNeeds/1/timeOfDay',
  'animal/dailyNeeds/1/need' ]
*/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published