'Convert the document to a JSON string.
Args:
indent (int or None, optional) : number of spaces to indent, or
None to suppress all newlines and indentation (default: None)
Returns:
str'

def to_json_string(self, indent=None):

    root_ids = []
    for r in self._roots:
        root_ids.append(r._id)
    root_references = self._all_models.values()
    json = {'title': self.title, 'roots': {'root_ids': root_ids, 'references': self._references_json(root_references)}, 'version': __version__}
    return serialize_json(json, indent=indent)
