UNPKG

jsonpath-object-transform

Version:
30 lines (24 loc) 474 B
/*jshint laxbreak:true*/ /*global window, require, console*/ var transform = (typeof exports === 'object') ? require('../lib/jsonpath-object-transform') : window.jsonpathObjectTransform; var path = { foo: ['$.some.crazy', { bar: '$.example' }] }; var data = { some: { crazy: [ { example: 'A' }, { example: 'B' } ] } }; var result = transform(data, path); console.log(JSON.stringify(result, null, 2));