Reading and Processing JSON with Rust vs Python.
Have you ever wondered about being explicit in your code vs being vague? I think about this a lot as I’m writing code on a daily basis. I’ve found I like being explicit and verbose when writing code, rather than being vague in what I’m doing most of the time.
When it comes to debugging and maintaining software I don’t want to have to wonder what’s going on, I want to be able to look at a piece of code or data type and know exactly what is going on without having to wonder what is happening or go dig through files.
I found I could process JSON with Rust in two ways.
- Make a Struct and HashMap and make it all explicit.
- Glom it all into a Value and reduce the code but make it vague.
It seemed like if you were going to go the Value route with Rust, at that point, you might as well just be doing it with Python. Giving up the Struct is like throwing away one of the best parts of Rust.
You can read more here. https://dataengineeringcentral.substack.com/p/json-with-rust