Only encode into json once