extra safety when doing json encoding