


To demonstrate a quick and easy conversion, we are using an example from the Open Data world.

I have put the final Python script in a GitHub gist for reference. Today’s solution will be reusable for different use cases and might save time in the long run. However, nobody wants to write a new parser and converter for each conversion from scratch. Use cases for converting JSON into other file formats are plenty: JSON to XML, JSON to another JSON dialect, etc. JSON is a popular format for semi-structured data. There are tools for out-of-the-box conversions, scripts, frameworks, libraries, but sometimes a simple solution is sufficient for the task at hand. Ask eight different software developers for their favorite way to do it and you get 128 answers. We will implement this with less than 30 LOC - and an example template to convert GeoJSON to KML and can be reused for many more conversions.Ĭonverting files from one format into another is a task that appears more often than not in a software developer’s everyday life. Need to convert a JSON file into another format? This can be realised quickly and reusable with a few lines of Python and Jinja2 templates.
