cleaner conversion between internal objects and json data. neccesary to implement relations