def __parse_organizations(self, json):
        try:
            for organization in json['organizations']:
                name = self.__encode(organization)
                org = self._organizations.get(name, None)
                if not org:
                    org = Organization(name=name)
                    self._organizations[name] = org
                domains = json['organizations'][organization]
                for domain in domains:
                    if type(domain['is_top']) != bool:
                        msg = "invalid json format. 'is_top' must have a bool value"
                        raise InvalidFormatError(cause=msg)
                    dom = Domain(domain=domain['domain'],
                                 is_top_domain=domain['is_top'])
                    org.domains.append(dom)
        except KeyError as e:
            msg = "invalid json format. Attribute %s not found" % e.args
            raise InvalidFormatError(cause=msg)