Core
Framework v2.x
2

getObject #

Available since 2.11.0

Gets a parameter from the request arguments and checks that it is an object.

Arguments #

Copied to clipboard!
getObject (name: string, def: JSONObject = null): JSONObject

Name Type Description
name
string
Parameter name
def
JSONObject
Default value to return if the parameter is not set

Example #

Copied to clipboard!
const metadata = request.getObject('metadata');
// equivalent
const metadata = request.input.args.metadata;
//+ checks to make sure that "metadata" is of the right type
// and throw standard API error when it's not the case