Rough JSON parsing implementation - no idea if it even works...