PayPal\Api\PatchRequest::toJSON PHP Method

toJSON() public method

As PatchRequest holds the array of Patch object, we would override the json conversion to return a json representation of array of Patch objects.
public toJSON ( integer $options ) : mixed | string
$options integer
return mixed | string
    public function toJSON($options = 0)
    {
        $json = array();
        foreach ($this->getPatches() as $patch) {
            $json[] = $patch->toArray();
        }
        return str_replace('\\/', '/', json_encode($json, $options));
    }