我有以下 JSON
{
"eventSummaryList": [
{
"customer": "189256",
"data": "{\"cliente\":\"189256\",\"data_posicao\":\"1491426372\",\"gps_valido\":\"1\",\"horimetro\":\"120561\",\"ibuttonHex\":\"0\",\"ibuttonPart1\":\"0\",\"ibuttonPart2\":\"0\",\"id_evento\":\"null\",\"id_motorista\":\"0\",\"ignicao\":\"1\",\"latitude\":\"-2222222\",\"longitude\":\"-2222222\",\"odometro\":\"253692\",\"pos_memoria\":\"0\",\"veiculo\":\"44444\",\"velocidade\":\"50\"}",
"identifierEventRule": "77404",
"identifierRule": "6",
"identifierSummary": "28901976",
"rule": "velocidade_maior_que",
"status": 1,
"vehicle": "44444"
}
],
"header": {
"mensagem": {
"estilo": "SUCCESS",
"mensagem": "Successfully executed service",
"plataforma": "EVENT_POINT",
"status": "SUCESSO"
}
}
}
而且我需要提取包含另一个json的“数据”中的值“velocidade”。
我正在使用以下语法,但它返回 null。
select cast((value::json ->'data')::json->> 'velocidade' AS int) AS velocidade,