extend sample with writing a json object