PHP Json to variables : Hi Sorry to ask the question that so many people have before me but i obviously dont understand, so im sending my json via c# and my php on my mysql server is catching it but where i usually catch with post I now see i should catch it using json_decode but even through i can see the data and print it out i can not seem to get it in to a usable format to insert into my database, hopefully you can help so:

    Array print out using print_r ($data); looks like this 
    
    /Array
    (
        [widget1] => 54
         [widget2] => tttt
        [widget3] => tttttttt
       [widget4] => 100
       [widget5] => 3
        [imageobject] => /9j/4QPqRXhpZgAATU0AKgAAAAgADAEbAAUAAAABAAAAngEaAAUAAAABAAAApgEAAAQAAAABAAAFUwEQAAIAAAAJAAAArgExAAIAAAAOAAAAtwEPAAIAAAAIAAAAxQEBAAQAAAABAAAD8wITAAMAAAABAAEAAIdpAAQAAAABAAAA4QESAAMAAAABAAAAAAEoAAMAAAABAAIAAAEyAAIAAAAUAAAAzQAAA3gAAABIAAAAAQAAAEgAAAABU00tRzk1NUYARzk1NUZYWFUyQ1JGNwBzYW1zdW5nADIwMTg6MDc6MTkgMTY6NDc6MjEAACCSAgAFAAAAAQAAAmeQAAAHAAAABDAyMjCSBAAKAAAAAQAAAm+IIgADAAAAAQACAACkIAACAAAAGQAAAnegAQADAAAAAQABAACSBQAFAAAAAQAAApCgAwADAAAAAQH5AACSAwAKAAAAAQAAApiQAwACAAAAFAAAAqCgAAAHAAAABDAxMDCSfAAHAAAAYgAAArSSkQACAAAABQAAAxakAwADAAAAAQAAAACgBQAEAAAAAQAAA2akAgADAAAAAQAAAACCmgAFAAAAAQAAAxuSCQADAAAAAQAAAACSkAACAAAABQAAAyOCnQAFAAAAAQAAAyiIJwADAAAA)

and im trying to access the data into variables like below which is obviously wrong


    <?php
    header('Content-Type: application/json;charset=utf-8');
    
    require "connect.php";
    
    
    //Make sure that it is a POST request.
    if(strcasecmp($_SERVER['REQUEST_METHOD'], 'POST') != 0){
        throw new Exception('Request method must be POST!');
    }
     
    //Make sure that the content type of the POST request has been set to application/json
    $contentType = isset($_SERVER["CONTENT_TYPE"]) ? trim($_SERVER["CONTENT_TYPE"]) : '';
    if(strcasecmp($contentType, 'application/json; charset=utf-8') != 0){
       throw new Exception('Content type must be: application/json '.$contentType);
      
    }
    
    //Receive the RAW post data.
    $content = trim(file_get_contents("php://input"));
     
    //Attempt to decode the incoming RAW post data from JSON.
    $data = json_decode($content, true);
     
    //If json_decode failed, the JSON is invalid.
    if(!is_array($data)){
        throw new Exception('Received content contained invalid JSON!');
    }
    
    print_r ($data);
    
    $Widget1= $data[0]->widget1; 
    $Widget2= $data[0]->widget2; 
    $Widget3= $data[0]->widget3; 
    $Widget4= $data[0]->widget4; 
    $Widget5= $data[0]->widget5; 
    $Widget6= $data[0]->imageobject; 


 
     