public function convert($object, $ignoreNonSerialisables = false, $prettyPrint = false) {

        // Normalise the input to array form.
        $object = $this->normaliseToArrayForm($object, $ignoreNonSerialisables);

        // Then simply encode using PHP JSON libraries.
        return json_encode($object, $prettyPrint ? JSON_PRETTY_PRINT : null);
    }