All Projects → aligay → jsonuri

aligay / jsonuri

Licence: MIT license
🌳 阿里剑鱼、iceluna、vanex 数据操作底层库,使用O(n) 复杂度回溯祖先节点

Programming Languages

typescript
32286 projects
HTML
75241 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to jsonuri

proxmox toolbox
A toolbox to get the firsts configurations of Proxmox VE / BS done in no time
Stars: ✭ 158 (+20.61%)
Mutual labels:  swap
fs2-data
streaming data parsing and transformation library
Stars: ✭ 103 (-21.37%)
Mutual labels:  jsonpath
ctxexp-parser
In the dynamic execution of JS language environment (wechat applet) to execute JS class calling function.
Stars: ✭ 17 (-87.02%)
Mutual labels:  jsonpath
SecureSnaps
Image Codec using Private-key cryptography
Stars: ✭ 13 (-90.08%)
Mutual labels:  swap
ajson
Abstract JSON for Golang with JSONPath support
Stars: ✭ 144 (+9.92%)
Mutual labels:  jsonpath
howto
Dumping ground for various HowTo documents that I produce
Stars: ✭ 58 (-55.73%)
Mutual labels:  swap
Cssjanus
↔️ Convert CSS stylesheets between left-to-right and right-to-left.              Made by Wikimedia.
Stars: ✭ 168 (+28.24%)
Mutual labels:  swap
deswappify-auto
automatically swap-in pages when enough memory is available
Stars: ✭ 30 (-77.1%)
Mutual labels:  swap
jsonpath
No description or website provided.
Stars: ✭ 117 (-10.69%)
Mutual labels:  jsonpath
pino-mongodb
🌲 Insert JSON from stdin into MongoDB
Stars: ✭ 43 (-67.18%)
Mutual labels:  insert
PancakeTokenSniper
BSC BNB Pancake token sniper, buy, take profit and rug check
Stars: ✭ 184 (+40.46%)
Mutual labels:  swap
yamlpath
Command-line get/set/merge/validate/scan/convert/diff processors for YAML/JSON/Compatible data using powerful, intuitive, command-line friendly syntax.
Stars: ✭ 78 (-40.46%)
Mutual labels:  jsonpath
robotframework-jsonvalidator
Robot Framework library for JSON validation
Stars: ✭ 21 (-83.97%)
Mutual labels:  jsonpath
nft-swap-sdk
Ethereum's missing p2p NFT and token swap library for web3 developers. Written in TypeScript. Powered by 0x.
Stars: ✭ 200 (+52.67%)
Mutual labels:  swap
zram-swap-manager
A versatile zRAM swap manager with dynamic swappiness - for Android and GNU/Linux systems.
Stars: ✭ 43 (-67.18%)
Mutual labels:  swap
json matcher
Library for simplifying data verification in functional tests for your JSON-based APIs
Stars: ✭ 24 (-81.68%)
Mutual labels:  jsonpath
json-path-comparison
Comparison of the different implementations of JSONPath and language agnostic test suite.
Stars: ✭ 64 (-51.15%)
Mutual labels:  jsonpath
jessie
JsonPath for Dart
Stars: ✭ 23 (-82.44%)
Mutual labels:  jsonpath
JSONPath.sh
JSONPath implementation in Bash for filtering, merging and modifying JSON
Stars: ✭ 45 (-65.65%)
Mutual labels:  jsonpath
convert-british-to-american-spellings
Convert text so that British spellings are swapped with their Americanized form or vice versa.
Stars: ✭ 26 (-80.15%)
Mutual labels:  swap

JSON URI


Use URI style methods to operate data. All operations friendly support Vue-like frameworks.

Build Status codecov npm dependencies Status devDependencies Status

Use

$ npm install jsonuri --save
import * as jsonuri from 'jsonuri'
// or
import { get, set, ... } from 'jsonuri' // recommended practice, friendly to tree-shaking

Example Data:

{
  "menu": {
    "id": 123,
    "list": [0, 1, 2, 3, 4],
    "popup": {
      "menuitem": [{
          "value": "New",
          "onclick": "CreateNewDoc()"
        },
        {
          "value": "Open",
          "onclick": "OpenDoc()"
        },
        {
          "value": "Close",
          "onclick": "CloseDoc()"
        }
      ]
    }
  }
}

Methods:

get (data, path)

Get the value of the specified data for the path.

Example:

jsonuri.get(data, 'menu/id')
// return 123

jsonuri.get(data, 'menu/popup/menuitem/0/value')
// return 'New'

jsonuri.get(data, 'menu/popup/menuitem/0/value/..')
// {value: "New", onclick: "CreateNewDoc()"}

see more

set (data, path, value)

Set the value of the specified data for the path.

Example:

jsonuri.set(data, 'menu/id/', 789)
jsonuri.get(data, 'menu/id')
//789

see more

rm (data, path)

Remove the value of the specified data for the path.

Example:

jsonuri.rm(data, 'menu/id')
jsonuri.get(data, 'menu/id') // undefined

see more

mv (data, pathA, pathB, sequence)

Data A moved to target B before or after.

Example:

jsonuri.mv(data, 'menu/list/0', 'menu/list/3')
jsonuri.get(data, 'menu/list') // [1, 2, 3, 0, 4]
[see more](test/spec/mv_spec.js)


jsonuri.set(data, 'menu/list/',[0,1,2,3,4])
jsonuri.mv(data, 'menu/list/0', 'menu/list/3', 'before')
jsonuri.get(data, 'menu/list') // [1, 2, 0, 3, 4]

see more

swap (data, pathA, pathB)

Data swap in an array.

Example:

jsonuri.swap(data, 'menu/list/0', 'menu/list/4')
jsonuri.get(data, 'menu/list') // [4, 1, 2, 3, 0]

jsonuri.swap(data, 'menu/list/0', 'menu/list/4')
jsonuri.get(data, 'menu/list') // [4, 1, 2, 3, 0]

see more

insert (data, pathA, value, direction)

Insert data into an array that is described in the path.

Example:

jsonuri.insert(data, 'menu/list/0', 9999, 'before') // [9999, 0, 1, 2, 3, 4]

see more

up(data, path, gap)

see more

down(data, path, gap)

see more

walk(data, descentionFn, ascentionFn)

Traverse each data of each node and value.

Example:

jsonuri.walk({a:{a1:'x'}}, (value, key, parent, { path }) => {
  console.log(value, key, parent, path)
})

// { a1: 'x' } 'a' { a: { a1: 'x' } } 'a'
// x a1 { a1: 'x' } 'a/a1'

see more

normalizePath(path1, path2, ...)

Example:

jsonuri.normalizePath('a', 'b') // a/b

jsonuri.normalizePath(['a', 'b', '../'], 'c') // a/c

see more

isCircular(obj)

Example:

jsonuri.isCircular({}) // return false
jsonuri.isCircular(window) // return true

var a = {}
jsonuri.set(a, '/b/c/d/e/f/g', a)
jsonuri.isCircular(a) // return true

see more

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].