def as_json(self):
        js = {}
        
        # JSONify all registered properties
        found = set()
        nonoptionals = set()
        for name, jsname, typ, is_list, of_many, not_optional in self.elementProperties():
            if not_optional:
                nonoptionals.add(of_many or jsname)
            
            val = getattr(self, name)
            if val is None:
                continue
            if is_list:
                if len(val) > 0:
                    found.add(of_many or jsname)
                js[jsname] = [v.as_json() if hasattr(v, 'as_json') else v for v in val]
            else:
                found.add(of_many or jsname)
                js[jsname] = val.as_json() if hasattr(val, 'as_json') else val
        
        # any missing non-optionals?
        if len(nonoptionals - found) > 0:
            for nonop in nonoptionals - found:
                logging.warning("Element '{}' is not optional, you should provide a value for it on {}"
                    .format(nonop, self))
        return js
    
    
    # MARK: Handling References
Deny WSGI Response.
dataset/ETHPy150Open smart-on-fhir/client-py/fhirclient/models/fhirabstractbase.py/FHIRAbstractBase.as_json--crossover with--dataset/ETHPy150Open openstack/swift/swift/common/middleware/keystoneauth.py/KeystoneAuth.denied_response