How php curl, gives undefined instead of null?

when I curl request to the counterparty

$data = array(
    "a" => $a,
    "b" => $b
  );
  $data_string = json_encode($data);

assume that my value to the counterparty is valuable
that the receipt will be null
can it be translated into
when I have no value
can I take the initiative to give the counterparty undefined instead of null?

The

counterpart is set as follows:
clipboard.png

Mar.02,2021

look at the type of value of b. If b has no value, use the default value of this type, but the b field exists to ensure that the structure is consistent rather than changing.


$data = array(
    "a" => $a,
  );
if($b)
{
    $data['b'] = $b;
}
Menu