@classmethod<EOL><INDENT>def _from_json(cls, reportdict):<DEDENT>
if reportdict["<STR_LIT>"]:<EOL><INDENT>if (<EOL>"<STR_LIT>" in reportdict["<STR_LIT>"]<EOL>and "<STR_LIT>" in reportdict["<STR_LIT>"]<EOL>):<EOL><INDENT>reprtraceback = reportdict["<STR_LIT>"]["<STR_LIT>"]<EOL>reprcrash = reportdict["<STR_LIT>"]["<STR_LIT>"]<EOL>unserialized_entries = []<EOL>reprentry = None<EOL>for entry_data in reprtraceback["<STR_LIT>"]:<EOL><INDENT>data = entry_data["<STR_LIT:data>"]<EOL>entry_type = entry_data["<STR_LIT:type>"]<EOL>if entry_type == "<STR_LIT>":<EOL><INDENT>reprfuncargs = None<EOL>reprfileloc = None<EOL>reprlocals = None<EOL>if data["<STR_LIT>"]:<EOL><INDENT>reprfuncargs = ReprFuncArgs(**data["<STR_LIT>"])<EOL><DEDENT>if data["<STR_LIT>"]:<EOL><INDENT>reprfileloc = ReprFileLocation(**data["<STR_LIT>"])<EOL><DEDENT>if data["<STR_LIT>"]:<EOL><INDENT>reprlocals = ReprLocals(data["<STR_LIT>"]["<STR_LIT>"])<EOL><DEDENT>reprentry = ReprEntry(<EOL>lines=data["<STR_LIT>"],<EOL>reprfuncargs=reprfuncargs,<EOL>reprlocals=reprlocals,<EOL>filelocrepr=reprfileloc,<EOL>style=data["<STR_LIT>"],<EOL>)<EOL><DEDENT>elif entry_type == "<STR_LIT>":<EOL><INDENT>reprentry = ReprEntryNative(data["<STR_LIT>"])<EOL><DEDENT>else:<EOL><INDENT>_report_unserialization_failure(entry_type, cls, reportdict)<EOL><DEDENT>unserialized_entries.append(reprentry)<EOL><DEDENT>reprtraceback["<STR_LIT>"] = unserialized_entries<EOL>exception_info = ReprExceptionInfo(<EOL>reprtraceback=ReprTraceback(**reprtraceback),<EOL>reprcrash=ReprFileLocation(**reprcrash),<EOL>)<EOL>for section in reportdict["<STR_LIT>"]["<STR_LIT>"]:<EOL><INDENT>exception_info.addsection(*section)<EOL><DEDENT>reportdict["<STR_LIT>"] = exception_info<EOL><DEDENT><DEDENT>return cls(**reportdict)<EOL>
This was originally the serialize_report() function from xdist (ca03269).

Factory method that returns either a TestReport or CollectReport, depending on the calling
class. It's the callers responsibility to know which class to pass here.

Experimental method.