The JSON filter will check if the value passed is valid JSON.

Extends AbstractFilter
Defined in: lib/filter/json.js:5

Methods

sanitize (value)

Inherited from AbstractFilter but overwritten in lib/filter/json.js:37

The sanitize method will sanitize the value passed to a proper JSON string.

Parameters

Name Type Description
value * The value to be parsed into JSON.

Returned Value

String: The JSON string of the value.


validate (value)

Inherited from AbstractFilter but overwritten in lib/filter/json.js:12

This method will try to check if the value is a string, If so to validate it it must be able to be parsed.

If the value is an object it is accepted.

Parameters

Name Type Description
value * The value to be validated.

Returned Value

Boolean: If the value is a valid JSON.