It’s been sometime since my last blog post, you might have thought this blog was dead, but it isn’t. Since my last post I have moved to London. I decided it was time to live in the northern hemisphere for a while and explore this part of the world. As you can imagine moving to the other side of the world does take a little bit of time. It also explains why my side project hasn’t progressed any further. I’m now a happy job hunter in merry old England. I am also trying to find a good C# community group, but sadly I’m having trouble finding even one that meets on a regular basis. So if you know of one let me know about it. Once things settle down a little bit I will start to post more and work on the project will commence.
As developers we often need to take minified JSON and XML and pretty print it so it is human readable. A multitude of websites provide a free service where you can enter minified JSON or XML and it will format it the data so it is human readable. The problem is this can lead to leaking data causing security incidents. The solution is to write a couple of bash scripts to pretty print. A big thanks to Campovski 's answer on stackoverflow for the JSON and Ben Noland 's answer on stackoverflow and Anton I. Sipos ' comment for the XML I took these answers a little further and created a bash script that accepts arguments so you can pretty print A file The result returned form an API A string Data piped in Both scripts have the same usage Format a file with the -f flag JSON ./pretty_json.sh -f <name_of_file> XML ./pretty_xml.sh -f <name_of_file> Format the return value of an API with the -u flag JSON ./pretty_json.sh -u www.api.com XML ./pretty_xml.sh -u ...
Comments
Post a Comment