save the json in buf