Anyone know how a good way to work with json in python?
Looking to run a job daily off my windows that does a ton of network requests and processes data from it, and I already have a job setup with python so I was looking to do it again. If you know any libraries that makes this less of a pain in the ass, or know a better way to do this (was previously doing it on site load in js and let's just say it isn't fast https://threehoolagins.github.io/lol-team-jerseys) with the windows task scheduler? Or with a very easy to setup task scheduler
4 Replies
what's the pain points if i may ask? perf? async? serialization?
i know there's this https://pypi.org/project/orjson/
also if your only problem with js is the performance you can try running your js using https://bun.sh/
Bun
Bun — A fast all-in-one JavaScript runtime
Bundle, install, and run JavaScript & TypeScript — all in Bun. Bun is a new JavaScript runtime with a native bundler, transpiler, task runner, and npm client built-in.
Python has a json library built into the standard library. It's easy to use and has been all I've needed for my scripts. Have you tried it to see if it's fast enough?
https://docs.python.org/3/library/json.html
Python documentation
json — JSON encoder and decoder
Source code: Lib/json/init.py JSON (JavaScript Object Notation), specified by RFC 7159(which obsoletes RFC 4627) and by ECMA-404, is a lightweight data interchange format inspired by JavaScript...
Thanks for the replies! I may look into how difficult it is to run bun on your local, I only know I stayed away from node since I hear it can be a pain to run.
I have been using the python json library- accessing things has been kinda a pain, I don't know if that's just my use case, but the dictionaries have been causing me some skill issues
Good news is in my experience, bun is significantly easier to run. If anything you can just use it to fetch the data and transform it into a more manageable shape for use in python