code: def from_json(payload):
          
          contact_item_number = len(payload)
          assert 2 <= contact_item_number <= 4, 'Invalid contact information format'
  
          is_primary = is_verified = None
  
          # Unpack the contact information to each component.
          if contact_item_number == 2:
              (name, value) = payload
          elif contact_item_number == 3:
              (name, value, is_primary) = payload
          else:
              (name, value, is_primary, is_verified) = payload
  
          return Contact(cast.string_to_enum(name, Contact.ContactName), value,
                  is_primary=is_primary and cast.string_to_boolean(is_primary, strict=True),
                  is_verified=is_verified and cast.string_to_boolean(is_verified, strict=True))
docs: Convert the JSON expression of a contact information into an instance
          `Contact.
  
  
          @param payload: a JSON expression representing a contact information:
  
              [ type:ContactName, value:string, [is_primary:boolean, [is_verified:boolean]] ]
  
  
          @return: an instance `Contact`.
  
  
          @raise AssertError: if the specified type of this contact information
              is not a string representation of an item of the enumeration
              `ContactName`.
  
          @raise ValueError: if the value of this contact information is null.