code: def from_json(cls, json_doc):
          
          try:
              d = json.load(json_doc)
          except AttributeError:  # catch the read() error
              d = json.loads(json_doc)
  
          return cls.from_dict(d)
docs: Parse a JSON string and build an entity.