PHP problem getting JSON POST after decrypting initial POST data

I have an Android app that POSTS data to a PHP server via Retrofit. The app uses encryption to send data to server. The encryption and decryption on the server works well.

I am now implementing a multipart POST in Retrofit for images. My tests are giving me an issue getting the JSON data after the decryption of the POST data happens.

Sample of what the message looks like before decrpytion:

{"message":"IPJqXxv3eI1HURLVEup+PXIoZ94vhsxCkvPEx8bhOXTV1iGmf89O...."}

Working example below without multipart data POST on PHP server:

    $data = json_decode(file_get_contents('php://input'));       

    $message = $data->{'message'};

    $json = $myUtils->decryptPost($message);

This is the relevent part of the decryption function:

    function decryptPost($message){

         ....

    $str = mb_convert_encoding($str, "UTF-8");

    $json = json_decode($str, true);

    return $json;
}

When I do the same with the multipart form data, $json is NULL.

What I have tried so far inside the end of the decryptPost function:

        $str = mb_convert_encoding($str, "UTF-8");

        echo $str;

This prints out the right data but I just can’t access it via JSON. The JSON name indicated in the app is labeled as “items”, which it is named properly.

> 2025-03-26 05:26:49.566 22294-22647 okhttp.OkHttpClient    
> com.itgeek25.syncourlists            I 
> --1dbcd23c-55d7-46aa-8801-422d2814fd62 2025-03-26 05:26:49.569 22294-22647 okhttp.OkHttpClient     com.itgeek25.syncourlists         
> I  Content-Disposition: form-data; name="items" 2025-03-26
> 05:26:49.570 22294-22647 okhttp.OkHttpClient    
> com.itgeek25.syncourlists            I  Content-Transfer-Encoding:
> binary 2025-03-26 05:26:49.571 22294-22647 okhttp.OkHttpClient    
> com.itgeek25.syncourlists            I  Content-Type:
> application/json; charset=UTF-8 2025-03-26 05:26:49.571 22294-22647
> okhttp.OkHttpClient     com.itgeek25.syncourlists            I 
> Content-Length: 182 2025-03-26 05:26:49.573 22294-22647
> okhttp.OkHttpClient     com.itgeek25.syncourlists            I  
> 2025-03-26 05:26:49.574 22294-22647 okhttp.OkHttpClient    
> com.itgeek25.syncourlists            I 
> {"category":"Books","deleted":[],"items":[{"id":71,"is_marked":1,"item":"Mistake"},{"id":72,"is_marked":1,"item":"Subardf"}],"list_id":147,"sol_id":-10,"title":"Something
> important"} 2025-03-26 05:26:49.574 22294-22647 okhttp.OkHttpClient   
> com.itgeek25.syncourlists            I 
> --1dbcd23c-55d7-46aa-8801-422d2814fd62--

Each approach returns either null or can’t access object in array:

$json = json_encode($str);
$json = json_decode($json, true);
echo $json['items'];
echo $json->{'items'};