json_encode()
toJson($value) $value: value to be converted to json format
toJson(['name'=>'foo']); //{"name":"foo"}