Edit parts of json strings & files while keeping the orginal, inconsistent formating
Project description
pyJsonEdit
Edit parts of inconsistently formatted json.
It's just a bit slower that doint this by hand!
how to install
pip install --upgrade pyjsonedit
json in python
Pure pyhon implementation of json encoder/decoder.
Its slow and unnecessary!
matcher
Now you can select nodes in json tree
syntax!
- | select all children in current node -----|----- [n] | select n-th item of curent node {n} | select n-th item of curent node key | select node chilld by name "key"| select node chilld by name > | go to next node
example: mask multiple nodes
$ ./pyjsonedit/print_color "quiz > * > q1 >*" DOC/example.json
{
"quiz": {
"sport": {
"q1": {
"question": XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,
"options": XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,
"answer": XXXXXXXXXXXXXXX
}
},
"maths": {
"q1": {
"question": XXXXXXXXXXX,
"options": XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX,
"answer": XXXX
},
"q2": {
"question": "12 - 8 = ?",
"options": [
"1",
"2",
"3",
"4"
],
"answer": "4"
}
}
}
}
example: mask selected nodes
$ import pyjsonedit
$ pyjsonedit.string_match_mark("{'pass':123}","pass")
{'pass':XXX}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyJsonEdit-0.0.13.tar.gz
(5.8 kB
view hashes)
Built Distribution
Close
Hashes for pyJsonEdit-0.0.13-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a92d72f364592645e84e4c9a69da58a5800f7960ec0f8d9caa0f58daf4f89fd7 |
|
MD5 | 5ff8ca5b5e187b464f1c5a1482bea30b |
|
BLAKE2b-256 | 28e95bff09814c6ddb959d79a4f4b78eca9aee399032af438bd88544479874fe |