“Request Body should be a valid JSON object.” (post /meetings/{meetingId}/registrants)

I want to register users for some meeting base on zoom api. Source is next:


but I cant do it.

my php code is:

<?php $client = Drupal::service('zoomapi.client'); $user = array( "email"=>$udata['uemail'], "first_name"=>stripslashes($udata['ufirstname']), "last_name"=>stripslashes($udata['ulastname']), "address"=>"", "city"=>"", "country"=>"DE", "zip"=>"", "state"=>"", "phone"=>"", "industry"=>"", "org"=>"", "job_title"=>"", "purchasing_time_frame"=>"", "role_in_purchase_process"=>"", "no_of_employees"=>"", "comments"=>"", "custom_questions"=>array(), "language"=>"de-DE" ); $meeting_number = 944876713XX; $response = $client->request('POST', '/meetings/' . $meeting_number . '/registrants', ['headers' => ['Content-Type' => 'application/json'], 'body' =>[ json_encode($dataJson)] ] ); //I tried too, because required is email and firstname $user = array( "email"=>$udata['uemail'], "first_name"=>stripslashes($udata['ufirstname']), "last_name"=>stripslashes($udata['ulastname']), /* "address"=>"", "city"=>"", "country"=>"DE", "zip"=>"", "state"=>"", "phone"=>"", "industry"=>"", "org"=>"", "job_title"=>"", "purchasing_time_frame"=>"", "role_in_purchase_process"=>"", "no_of_employees"=>"", "comments"=>"", "custom_questions"=>array(), "language"=>"de-DE"*/ ); $response = $client->request('POST', '/meetings/' . $meeting_number . '/registrants', $user); ?>

I get this error:
GuzzleHttp\Exception\ClientException : Client error: POST https://api.zoom.us/v2/meetings/94487671384/registrants?headers%5BContent-Type%5D=application%2Fjson&body%5B0%5D=%7B%22email%22%3A%22masteroma%40gmail.com%22%2C%22first_name%22%3A%22Roman%22%2C%22last_name%22%3A%22Bunyak%22%7D resulted in a 400 Bad Request response: <?xml version="1.0" encoding="UTF-8" standalone="yes"?>300Request Body should be a valid JS (truncated…) in GuzzleHttp\Exception\RequestException::create() (line 114 of vendor/guzzlehttp/guzzle/src/Exception/RequestException.php ).

It would be great if you can help me with this.

Thank you!

I have the same error with a curl request, the same request works into postman, I tought about encoding but cannot find the problem