added json marshalling and unmarshalling support to most of the api