class ServicesParserJSON in Services 7.3
Hierarchy
- class \ServicesParserJSON implements ServicesParserInterface
Expanded class hierarchy of ServicesParserJSON
2 string references to 'ServicesParserJSON'
- rest_server_request_parsers in servers/
rest_server/ rest_server.module - Builds a list of request parsers that are available to the RESTServer.
- ServicesRESTServerTests::testParseRequestBody in servers/
rest_server/ tests/ ServicesRESTServerTests.test - Test for parseRequestBody() method.
File
- servers/
rest_server/ includes/ ServicesParser.inc, line 113
View source
class ServicesParserJSON implements ServicesParserInterface {
public function parse(ServicesContextInterface $context) {
$requestBody = $context
->getRequestBody();
if ($requestBody) {
$data = json_decode($requestBody, TRUE);
if ($data === NULL) {
return services_error(t('Invalid JSON.'), 400);
}
return $data;
}
return $requestBody;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ServicesParserJSON:: |
public | function |
Overrides ServicesParserInterface:: |