first version of serializing to json