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.11.tar.gz
(5.5 kB
view hashes)
Built Distribution
Close
Hashes for pyJsonEdit-0.0.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27082bbf0b98a4910b97aab540f50b55389a4ff1f552529c96ec399db6e57aef |
|
MD5 | 003ab6c5cb5c608e41e7438ab9c53cba |
|
BLAKE2b-256 | 4f36588e0027b14cf5b76f3c957d821f6cc3f46315c83302668bd3bbc10b2133 |