This is my first ever Zig project! It’s a small JSON minifier, called jm. It can read either from stdin or from a file. Currently it’s very naive and simply collapses whitespace outside of any strings enclosed in double quotes, so it works over things like Zon and the like, but I want to eventually make it a customizable JSON formatter/pretty printer, but I couldn’t quite wrap my head around std.json yet…
Any feedback is certainly welcome, I’m very new to Zig and very much still learning.
Thanks in part to the help of the amazing people on these forums, I’ve just pushed a commit to the repository that properly minifies using std.json instead of writing my own state machine. That worked just for minification, but I want to make this a customizable JSON formatter
JM is now more than just a JSON minifier! With my latest commit, it can serve as a complete JSON formatter and pretty printer according to how Zig formats JSON. You can use –indent-tabs to use tabs, –indent 1, 2, 4 or 8 for that number of spaces, or 0 for the default minification behavior.