json_msg = '{"topic1": 1.0, "topic2": {"x": 0.1}}'
493068
def publish(self, json_msg):
        '''
        
        '''
        pyobj = json.loads(json_msg)
        for topic, value in pyobj.items():
            msg = '{topic} {data}'.format(topic=topic, data=json.dumps(value))
            self._pub.publish(msg)
354437
def shell2json(s):
    """"""
    replace = {
        r'BinData\(.+?\)': '1',
        r'(new )?Date\(.+?\)': '1',
        r'Timestamp\(.+?\)': '1',
        r'ObjectId\(.+?\)': '1',
        r'DBRef\(.+?\)': '1',
        r'undefined': '1',
        r'MinKey': '1',
        r'MaxKey': '1',
        r'NumberLong\(.+?\)': '1',
        r'/.+?/\w*': '1'
    }

    for key, value in replace.items():
        s = re.sub(key, value, s)

    return s
833181
def ToJson(self):
        
        jsn = {
            'name': self.name,
            'symbol': self.symbol,
            'decimals': self.decimals,
            'script_hash': self.ScriptHash.To0xString(),
            'contract_address': self.Address
        }
        return jsn
674462
def get_name2value_dict(self):
        """"""
        x = {}
        for val, num in self._values:
            x[val] = num
        return x
417235
def json(self):
        
        json_string = json.dumps(
            self.scores,
            indent=2,
            allow_nan=True
        )
        return json_string
838103
def pipe_value(self, message):
        ''
        jmsg = json.dumps(message)
        self.send(jmsg)
718214
def from_json(cls, json_string):
        
        input_dict = json.loads(json_string)
        # convert index to tuple if required
        if input_dict['index'] and isinstance(input_dict['index'][0], list):
            input_dict['index'] = [tuple(x) for x in input_dict['index']]
        # convert index_name to tuple if required
        if isinstance(input_dict['meta_data']['index_name'], list):
            input_dict['meta_data']['index_name'] = tuple(input_dict['meta_data']['index_name'])
        data = input_dict['data'] if input_dict['data'] else None
        return cls(data=data, index=input_dict['index'], **input_dict['meta_data'])
86773
def json(self, var, default=NOTSET):
        
        return self.get_value(var, cast=json.loads, default=default)
272520
function parseMessage(msg, jsonEncode) {
    if (typeof msg === 'string') {
        msg = { data: msg };
    }

    var output = '';
    if (msg.event) {
        output += 'event: ' + msg.event + '\n';
    }

    if (msg.retry) {
        output += 'retry: ' + msg.retry + '\n';
    }

    if (msg.id) {
        output += 'id: ' + msg.id + '\n';
    }

    var data = msg.data || '';
    if (jsonEncode) {
        data = JSON.stringify(data);
    }

    output += parseTextData(data);

    return output;
}
204830
def json(self):
        
        return {
            'name': self.name,
            'message': self.message,
            'description': self.description,
            'reference_url': self.reference_url,
            'tags': self.tags,
        }
1183899
def _st_decode(self, msg):
        """"""
        group = int(msg[4:5])
        temperature = int(msg[7:10])
        if group == 0:
            temperature -= 60
        elif group == 1:
            temperature -= 40
        return {'group': group, 'device': int(msg[5:7])-1,
                'temperature': temperature}
850021
def AsJsonString(self):
        
        return json.dumps(self.AsDict(dt=False), sort_keys=True)
1159235
def format_json(event, colored):
        

        try:
            if event.message.startswith("{"):
                msg_dict = json.loads(event.message)
                event.message = json.dumps(msg_dict, indent=2)
        except Exception:
            # Skip if the event message was not JSON
            pass

        return event
888301
def json_repr(self, minimal=False):
        
        if self.value:
            return [self.field, self.operator, self.value]
        else:
            return [self.field, self.operator]
891793
def _from_dict(cls, _dict):
        """"""
        args = {}
        if 'sentence_id' in _dict:
            args['sentence_id'] = _dict.get('sentence_id')
        else:
            raise ValueError(
                'Required property \'sentence_id\' not present in SentenceAnalysis JSON'
            )
        if 'text' in _dict:
            args['text'] = _dict.get('text')
        else:
            raise ValueError(
                'Required property \'text\' not present in SentenceAnalysis JSON'
            )
        if 'tones' in _dict:
            args['tones'] = [
                ToneScore._from_dict(x) for x in (_dict.get('tones'))
            ]
        if 'tone_categories' in _dict:
            args['tone_categories'] = [
                ToneCategory._from_dict(x)
                for x in (_dict.get('tone_categories'))
            ]
        if 'input_from' in _dict:
            args['input_from'] = _dict.get('input_from')
        if 'input_to' in _dict:
            args['input_to'] = _dict.get('input_to')
        return cls(**args)
366873
function _parseMessage() {
    let message = [].slice.call(arguments).join("|");
    try {
        message = (typeof message === "string") ? message : JSON.stringify(message);
    } catch(e) {
        logger.error(e.stack);
    }

    return message;
}
97362
def _JsonValueToPythonValue(json_value):
    """"""
    util.Typecheck(json_value, JsonValue)
    _ValidateJsonValue(json_value)
    if json_value.is_null:
        return None
    entries = [(f, json_value.get_assigned_value(f.name))
               for f in json_value.all_fields()]
    assigned_entries = [(f, value)
                        for f, value in entries if value is not None]
    field, value = assigned_entries[0]
    if not isinstance(field, messages.MessageField):
        return value
    elif field.message_type is JsonObject:
        return _JsonObjectToPythonValue(value)
    elif field.message_type is JsonArray:
        return _JsonArrayToPythonValue(value)