write model to json