def _to_json(self):
def disassembled_report(rep):<EOL><INDENT>reprtraceback = rep.longrepr.reprtraceback.__dict__.copy()<EOL>reprcrash = rep.longrepr.reprcrash.__dict__.copy()<EOL>new_entries = []<EOL>for entry in reprtraceback["<STR_LIT>"]:<EOL><INDENT>entry_data = {<EOL>"<STR_LIT:type>": type(entry).__name__,<EOL>"<STR_LIT:data>": entry.__dict__.copy(),<EOL>}<EOL>for key, value in entry_data["<STR_LIT:data>"].items():<EOL><INDENT>if hasattr(value, "<STR_LIT>"):<EOL><INDENT>entry_data["<STR_LIT:data>"][key] = value.__dict__.copy()<EOL><DEDENT><DEDENT>new_entries.append(entry_data)<EOL><DEDENT>reprtraceback["<STR_LIT>"] = new_entries<EOL>return {<EOL>"<STR_LIT>": reprcrash,<EOL>"<STR_LIT>": reprtraceback,<EOL>"<STR_LIT>": rep.longrepr.sections,<EOL>}<EOL><DEDENT>d = self.__dict__.copy()<EOL>if hasattr(self.longrepr, "<STR_LIT>"):<EOL><INDENT>if hasattr(self.longrepr, "<STR_LIT>") and hasattr(<EOL>self.longrepr, "<STR_LIT>"<EOL>):<EOL><INDENT>d["<STR_LIT>"] = disassembled_report(self)<EOL><DEDENT>else:<EOL><INDENT>d["<STR_LIT>"] = six.text_type(self.longrepr)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>d["<STR_LIT>"] = self.longrepr<EOL><DEDENT>for name in d:<EOL><INDENT>if isinstance(d[name], (py.path.local, Path)):<EOL><INDENT>d[name] = str(d[name])<EOL><DEDENT>elif name == "<STR_LIT:result>":<EOL><INDENT>d[name] = None  <EOL><DEDENT><DEDENT>return d<EOL>
This was originally the serialize_report() function from xdist (ca03269).

Returns the contents of this report as a dict of builtin entries, suitable for
serialization.

Experimental method.