JSON error yet it's a valid json?

Format Your New Topic as Follows:

API Endpoint(s) and/or Zoom API Event(s)

POST https://api.zoom.us/v2/phone/external_contacts

Description
I fiddle arround an allegedly JSON error which turns out to be just some wired behavior of the Zoom API. And yes, I am 100% sure it’s not some parsing error etc. as you will see below.

Error Message

{
    "code": 300,
    "message": "Request Body should be a valid JSON object."
}

Code

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $token,
    'Content-Type: application/json',
]);

So far, so good. Everything seems fine. After the first code-checks I also sent the request to another endpoint where I logged everything I fetched:

  • Header: OK
    • Content-Type: OK
  • Content: OK
    • Content is sent: YES
    • Content is JSON: YES
    • Content JSON can be decoded: YES
    • Decoded JSON is valid / usable: YES

After that, I played arround even more. And the fun begins.

Example contact I send to Zoom API: (from the documentation)

{
  "description": "External contact Johnson",
  "email": "example@example.com",
  "extension_number": "101014",
  "id": "external_contact_01",
  "name": "Johnson",
  "phone_numbers": [
    "+12058945656"
  ],
  "routing_path": "PSTN",
  "auto_call_recorded": true
}

How To Reproduce my Error
Aside the given error above, if I send the demo contact to the API, I get the at this point expected:

{
    "code": 300,
    "message": "Request Body should be a valid JSON object."
}

What is really strange is what happens if I send the very same JSON object without "phone_numbers"key-value pair:

{
    "code": 400,
    "message": "Phone number cannot be blank."
}

Which means, Zoom is pretty well able to read / validate my JSON object, they just plain refuse to do so for some reason. Since I send 1:1 the demo-account they supplied in their documentation, I unable to guess whats the problem with this contact data.

Does anyone have any idea / trick what we can check / enable / update / modify to get something going. It’s pretty nuts the JSON-validation seemingly is also thrown aside JSON errors.