Same as self.sync except it assumes the returned result is json, and loads the payload of the return object
        if the returned (data) is not of level (20) an error is raised.
        :Return: Data
438218
def json(self, command, arguments, tags=None, id=None):
        
        result = self.sync(command, arguments, tags=tags, id=id)
        if result.level != 20:
            raise RuntimeError('invalid result level, expecting json(20) got (%d)' % result.level)

        return json.loads(result.data)
66428
def loads(self, data, raw=False):
        '''
        
        '''
        data = self.decrypt(data)
        # simple integrity check to verify that we got meaningful data
        if not data.startswith(self.PICKLE_PAD):
            return {}
        load = self.serial.loads(data[len(self.PICKLE_PAD):], raw=raw)
        return load
154209
def result(self):
        
        final_result = {'epoch_idx': self.global_epoch_idx}

        for key, value in self.frozen_results.items():
            final_result[key] = value

        return final_result
154087
def json_data(self, instance, default=None):
        
        value = self.get(instance)
        return value or default
21337
async def get_data(self, raw: bool=True) -> AnyStr:
        """"""
        try:
            body_future = asyncio.ensure_future(self.body)
            raw_data = await asyncio.wait_for(body_future, timeout=self.body_timeout)
        except asyncio.TimeoutError:
            body_future.cancel()
            from ..exceptions import RequestTimeout  # noqa Avoiding circular import
            raise RequestTimeout()

        if raw:
            return raw_data
        else:
            return raw_data.decode(self.charset)
773183
def load(self, callback=None, errback=None, reload=False):
        
        if not reload and self.data:
            raise MonitorException('monitor already loaded')

        def success(result, *args):
            self.data = result
            if callback:
                return callback(self)
            else:
                return self

        return self._rest.retrieve(self.data['id'], callback=success,
                                   errback=errback)
86773
def json(self, var, default=NOTSET):
        
        return self.get_value(var, cast=json.loads, default=default)
43064
def get_data(self):
        
        data = graceful_chain_get(self.json, "data")
        if data is None:
            return {}

        data_dict = {}
        for key in data:
            if self.is_yaml(key):
                data_dict[key] = yaml.load(data[key])
            else:
                data_dict[key] = json.loads(data[key])

        return data_dict
675160
def fetch_synchronize_status():
    
    r = Response()
    project = cd.project.get_internal_project()

    if not project:
        r.fail(
            code='NO_PROJECT',
            message='No open project on which to retrieve status'
        )
    else:
        with open(project.source_path, 'r') as f:
            definition = json.load(f)

        result = status.of_project(project)
        r.update(
            sync_time=sync_status.get('time', 0),
            source_directory=project.source_directory,
            remote_source_directory=project.remote_source_directory,
            status=result,
            definition=definition
        )

    return r.flask_serialize()
1238995
def sync(self):
        
        app = self._api.post(url=self._URL['sync'].format(id=self.id)).json()
        return App(api=self._api, **app)
506908
def _process_response(self):
        
        response = self.conn.getresponse()
        if response.status == 200 or response.status == 201:
            data = response.read()
        else:
            data = {
                "error":  {
                    "code": response.status,
                    "reason": response.reason,
                    "data": response.read()
                }
            }

        return data
1026825
def _postback(self):
        
        return requests.post(self.get_endpoint(),
                             data=dict(cmd="_notify-synch", at=IDENTITY_TOKEN, tx=self.tx)).content
147476
def data(self):
        
        try:
            data = self._data
        except AttributeError:
            data = self._data = json.loads(self.json)
        return data
9139
def validate_json(data: str):
    
    result = None
    try:
        result = json.loads(data)
    except ValueError as error:
        log(ERROR, "invalid json: %s", error)

    return result
1362498
def sync_fetch(request, method, default_headers=None,
               httpclient=None, **kwargs):
    
    updated_request = make_request(request, method, default_headers, **kwargs)
    if not httpclient:
        httpclient = HTTPClient()
    rsp = httpclient.fetch(updated_request)
    return parse_response(rsp)
646316
def sync(self, json_obj=None):
        
        LOGGER.debug("Container.sync")
        if json_obj is None:
            params = None
            if self.id is not None:
                params = SessionService.complete_transactional_req({'ID': self.id})

            if params is not None:
                if MappingService.driver_type != DriverFactory.DRIVER_REST:
                    params['OPERATION'] = 'getContainer'
                    args = {'properties': params}
                else:
                    args = {'http_operation': 'GET', 'operation_path': 'get', 'parameters': params}

                response = ContainerService.requester.call(args)

                if MappingService.driver_type != DriverFactory.DRIVER_REST:
                    response = response.get()

                if response.rc == 0:
                    json_obj = response.response_content
                else:
                    err_msg = 'Container.sync - Problem while syncing container (id: ' + str(self.id) + '). ' \
                              'Reason: ' + str(response.response_content) + ' - ' + str(response.error_message) + \
                              " (" + str(response.rc) + ")"
                    LOGGER.warning(err_msg)
                    if response.rc == 500 and ArianeMappingOverloadError.ERROR_MSG in response.error_message:
                        raise ArianeMappingOverloadError("Container.sync", ArianeMappingOverloadError.ERROR_MSG)
                    # traceback.print_stack()
        elif 'containerID' not in json_obj:
            err_msg = 'Container.sync - Problem while syncing container (id: ' + str(self.id) + '). ' \
                      'Reason: inconsistent json_obj' + str(json_obj) + " from : \n"
            LOGGER.warning(err_msg)
            # traceback.print_stack()

        if json_obj is not None:
            self.id = json_obj['containerID']
            self.name = json_obj['containerName']
            self.gate_uri = json_obj['containerGateURI']
            self.primary_admin_gate_id = json_obj['containerPrimaryAdminGateID']
            self.cluster_id = json_obj['containerClusterID'] if 'containerClusterID' in json_obj else None
            self.parent_container_id = json_obj['containerParentContainerID'] if 'containerParentContainerID' \
                                                                                 in json_obj else None
            self.child_containers_id = json_obj['containerChildContainersID']
            self.gates_id = json_obj['containerGatesID']
            self.nodes_id = json_obj['containerNodesID']
            self.company = json_obj['containerCompany']
            self.product = json_obj['containerProduct']
            self.type = json_obj['containerType']
            if MappingService.driver_type != DriverFactory.DRIVER_REST:
                if 'containerProperties' in json_obj:
                    self.properties = DriverTools.json2properties(json_obj['containerProperties'])
                else:
                    self.properties = None
            else:
                self.properties = json_obj['containerProperties'] if 'containerProperties' in json_obj else None
756668
def _fail_if_contains_errors(response, sync_uuid=None):
    
    if response.status_code != _HTTP_OK:
        raise RequestError(response)
    response_json = response.json()
    if sync_uuid and 'sync_status' in response_json:
        status = response_json['sync_status']
        if sync_uuid in status and 'error' in status[sync_uuid]:
            raise RequestError(response)