JSONResponse¶
-
class
OCP\AppFramework\Http\
JSONResponse
¶ - A renderer for JSON calls
Source: lib/public/AppFramework/Http/JSONResponse.php#42 Parent: OCP\AppFramework\Http\Response
Properties¶
-
protected static property
OCP\AppFramework\Http\JSONResponse::$
data
¶ - response data
Source: lib/public/AppFramework/Http/JSONResponse.php#48 Type: array | object
Methods¶
-
public
OCP\AppFramework\Http\JSONResponse::
__construct
($data=[], $statusCode=\OCP\AppFramework\Http::STATUS_OK)¶ - constructor of JSONResponse
Source: Parameters: - $data (array | object) the object or array that should be transformed
- $statusCode (int) the Http status code, defaults to 200
Since: 6.0.0
-
public
OCP\AppFramework\Http\JSONResponse::
render
()¶ - Returns the rendered json
Source: lib/public/AppFramework/Http/JSONResponse.php#72 Returns: string the rendered json Since: 6.0.0 Throws: \Exception
If data could not get encoded
-
public
OCP\AppFramework\Http\JSONResponse::
setData
($data)¶ - Sets values in the data json array
Source: Parameters: - $data (array | object) an array or object which will be transformed
to JSON
Returns: \OCP\AppFramework\Http\JSONResponse
Reference to this objectSince: 6.0.0 - return value was added in 7.0.0
-
public
OCP\AppFramework\Http\JSONResponse::
getData
()¶ - Used to get the set parameters
Source: lib/public/AppFramework/Http/JSONResponse.php#101 Returns: array the data Since: 6.0.0