User Tools

Site Tools


libraries:restwebservice:restrequestclass:getjsoncontent

RestRequest::getJsonContent()


Definition

Returns a JSON content string transmitted with the request du an associative array structure.

Important! There is no data/content check before the method is trying to convert a JSON string to a structure. Only use this method, if you can make sure, that the source content is correct JSON.

Array getJsonContent ( )

Returns

  • Array
    Associative array structure which is filled with the data from a JSON content string submittet by the client.

Example

$Request = new RestRequest();
 
// Called endpoint is: [PUT] https://www.domain.com/webservice/accounting/booking
// Content is:         "{'id':5,'account':1234,'name':'Mr. Smith','amount':592.30}"
 
$Content = $Request->getJsonContent();  // array ("id"      => 5, 
                                        //        "account" => 1234, 
                                        //        "name"    => "Mr. Smith"
                                        //        "amount"  => 592.30)
libraries/restwebservice/restrequestclass/getjsoncontent.txt · Last modified: 2022/12/22 14:19 by michael.pohl