@classmethod<EOL><INDENT>def from_json(cls, json_obj):<DEDENT>
if isinstance(json_obj, str):<EOL><INDENT>json_obj = json.loads(json_obj)<EOL><DEDENT>type = None<EOL>time = None<EOL>data = None<EOL>if cls.TYPE_FIELD_NAME in json_obj:<EOL><INDENT>type = json_obj[cls.TYPE_FIELD_NAME]<EOL><DEDENT>if cls.TIME_FIELD_NAME in json_obj:<EOL><INDENT>time = json_obj[cls.TIME_FIELD_NAME]<EOL><DEDENT>else:<EOL><INDENT>raise InvalidEventError("<STR_LIT>".format(<EOL>field=cls.TIME_FIELD_NAME))<EOL><DEDENT>if cls.DATA_FIELD_NAME in json_obj:<EOL><INDENT>data = json_obj[cls.DATA_FIELD_NAME]<EOL><DEDENT>return cls(type, time, data)<EOL>
Build an Event from JSON.

        :param json_obj: JSON data representing a Cube Event
        :type json_obj: `String` or `json`
        :throws: `InvalidEventError` when any of time field is not present
        in json_obj.