change serialize to json_encode