Are you sure that the error is happening with json_encode? Works fine for me in tinker (php 7.4)
Oct 6, 2020
6
Level 1
Json encode null issue
Hi , I have a array which has empty string as value for an key (""), but when i json encode it its making that "" into a null value, how can i avoid this?
$data = [
"some_key"=>"",
"some_other_key"=>"xyz",
"timestamp"=>1601900562163
];
dd(json_encode($data));
Result {"some_key":null,"some_other_key":"xyz","timestamp":1601900562163}
Expected {"some_key":"","some_other_key":"xyz","timestamp":1601900562163}
Please or to participate in this conversation.