The right way to json_encode()