I am encoding my array to JSON format but it is not breaking line from the new line operator (\n).
So how to achieve this
$array = ["string" => "hello \ngood morning!!"];
$encodedJson = json_encode($array);
dd(encodedJson);
Outputs
{"string":"hello \ngood morning!!"}
But what I wanted is
{
"string" :"hello
good morning!!"
}
I also tried
json_encode($array,JSON_UNESCAPED_LINE_TERMINATORS);