Installation
Quick Take
Examples
Purpose
Edit JSON contents as strings to guarantee the formatting will be intact.
API uses object-path
notation to set values on any (for now, only already-existing) paths in JSON.
It’s powering the update-versions
CLI.
API — set()
The function set()
is imported like this:
It’s a function which takes three input arguments:
Input argument | Type | Obligatory | Description |
---|---|---|---|
str Type: String Obligatory: yes | |||
str | String | yes | JSON file contents |
path Type: String Obligatory: yes | |||
path | String | yes | Desired EXISTING path in the object, must follow object-path notation |
valToInsert Type: Whatever Obligatory: yes | |||
valToInsert | Whatever | yes | What to insert at the given path |
You can’t create new paths, only amend existing-ones.
Function returns an amended string.
API — del()
The function del()
is imported like this:
It’s a function which takes two input arguments:
Input argument | Type | Obligatory | Description |
---|---|---|---|
str Type: String Obligatory: yes | |||
str | String | yes | JSON file contents |
path Type: String Obligatory: yes | |||
path | String | yes | Desired path in the object to delete, must follow object-path notation |
Function returns an amended string.
API — version
You can import version
: