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

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)