Returns the selected field *attributes* for each :class:`Field` *nested*
        in the `Container` as a JSON formatted string.

        The *attributes* of each :class:`Field` for containers *nested* in the
        `Container` are viewed as well (chained method call).

        :param str attributes: selected :class:`Field` attributes.
            Fallback is the field :attr:`~Field.value`.
        :keyword tuple fieldnames: sequence of dictionary keys for the selected
            field *attributes*.
            Defaults to ``(*attributes)``.
        :keyword bool nested: if ``True`` all :class:`Pointer` fields in the
            `Container` views their referenced :attr:`~Pointer.data` object
            field attributes as well (chained method call).

def to_json(self, *attributes, **options):
        """ Returns the selected field *attributes* for each :class:`Field` *nested*
        in the `Container` as a JSON formatted string.

        The *attributes* of each :class:`Field` for containers *nested* in the
        `Container` are viewed as well (chained method call).

        :param str attributes: selected :class:`Field` attributes.
            Fallback is the field :attr:`~Field.value`.
        :keyword tuple fieldnames: sequence of dictionary keys for the selected
            field *attributes*.
            Defaults to ``(*attributes)``.
        :keyword bool nested: if ``True`` all :class:`Pointer` fields in the
            `Container` views their referenced :attr:`~Pointer.data` object
            field attributes as well (chained method call).
        """
        nested = options.pop('nested', False)
        fieldnames = options.pop('fieldnames', attributes)
        if 'cls' in options.keys():
            return json.dumps(self.view_fields(*attributes,
                                               nested=nested,
                                               fieldnames=fieldnames),
                              **options)
        else:
            return json.dumps(self.view_fields(*attributes,
                                               nested=nested,
                                               fieldnames=fieldnames),
                              cls=_CategoryJSONEncoder,
                              **options)