Microjson
Archived - small json parser for embedding in Python scripts, pre-json module
Install / Use
/learn @phensley/MicrojsonREADME
About
microjson - A minimal, valid, pure-Python JSON parser/emitter.
Goal was to create something small enough to be embedded into standalone scripts, enabling them to talk to an API which returns JSON data, like Github's, without relying on external dependencies other than the Python standard library.
Github offers multiple encodings, but I prefer the ease of working with JSON over XML; YAML is nice too, though I wasn't interested in writing a YAML parser.
Usage
obj = microjson.from_json(json_data)
json_data = microjson.to_json(obj)
Embedding
I typically write the standalone scripts with this pattern:
def main():
do_something()
if __name__ == "__main__":
main()
If and when I need to update microjson, I'll pull down the latest from Github and use a sed command to generate the final script:
% sed -e '/^@MICROJSON@$/ { <return>
r microjson.py <return>
d; }' myscript.in >myscript
If you use cat or some other method of embedding microjson.py, make sure the "if __name__ ..." line is at the end of the script.
Related Skills
node-connect
341.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
341.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.6kCommit, push, and open a PR
