Abstract out the json implementation