Encode the data with json