process the json output - WIP, this is just a skeleton