replace document method missed json_encode call