I'm struggling to parse a JSON file where each record is split by `transaction_id`. My shell script seems to fail as it can't read the JSON file properly, preventing it from processing as needed. I've included a snippet of my code where I attempt to extract `transaction_id` values and categorize them based on the last character. However, I'm stuck and could really use some guidance on how to get this working on my older Unix version without the ability to install new libraries like jq.
5 Answers
If you just need something straightforward, Perl could do the trick for parsing the JSON into a hash. It's a solid choice for older systems.
You could try asking ChatGPT for help with this! Just give it a sanitized sample of the JSON, and it should be able to guide you through the parsing.
You should definitely consider using jq for handling JSON. It's designed for this kind of task and makes parsing super simple!
Thanks for the tip! I would love to use jq, but my current Unix setup doesn’t allow for new installations. It’s a bit frustrating.
A sample of your JSON file would really help us understand the structure you're working with. Also, there's a utility called [gron](https://github.com/tomnomnom/gron) that could come in handy for your situation.
If you have access, consider setting up a Python virtual environment with the updated libraries. It should really help you parse the JSON easily.
What do you mean by a sanitized sample? Can you clarify that for me?