In order to export the ello.co feed, I need to convert the JSON to XML. This isn’t the first time I have needed to look at this sort of problem and so I have created a page to hold my notes. I have put these things together in a python script, and posted it to github, in a repo called ello2rss.

It should be noted however, that the JSON file still documents the GUID using their V1 api which no longer exists and so is useless. It is not possible to translate the V1 link structure to V2, or at the very least, not documented nor available; others might think it worth the arseache but if they don’t want it done I don’t think I am the person to reverse engineer the api and then maintain it.I found these resources explicitly,

  1. http://stackoverflow.com/questions/8988775/convert-json-to-xml-in-python
  2. https://docs.python.org/2/library/json.html
  3. http://stackoverflow.com/questions/352098/how-can-i-pretty-print-json
  4. https://docs.python.org/3.2/library/pprint.html

And for a specific python problem,

  1. How do you read from stdin in python from stackoverflow
  2. how to filter tags from a string using the re module at stackover flow
  3. using command line arguments and getopts in python

and these two wiki resources, on twitter and tagged xml are probably useful. I have looked quite hard at these conversions before although wordpress may have got in the way.

  1. https://davelevy.info/wiki/twitter-api-v1-1/
  2. https://davelevy.info/wiki/tag/xml/

If one want to write a script, here’s some stuff to help write the XML

  1. http://en.wikipedia.org/wiki/RSS
  2. http://www.rssboard.org/rss-specification

And here’s some python hints

  1. Parsing a JSON data block using Python at stackexchange
  2. http://stackoverflow.com/questions/20199126/reading-a-json-file-using-python
  3. http://stackoverflow.com/questions/16929359/create-dictionary-from-list-python
  4. http://stackoverflow.com/questions/16129652/accessing-json-elements includes an illustration of using python’s urllib
  5. You need to handle multi-byte characters, I discuss that here; the JSON has non-ascii characters and there needs to be some unicode handling in the code.


One thought on “JSON to XML

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.