我有一个字符串,需要提取device_id。在示例中,我需要“00:06:66:7C:6A:C0”
{ "app_data_quota":{"max":153600,"used":9432},
"aux_device_data_reference":{"reference_id":70},
"aux_device_data_in":{"device_id":"00:06:66:7C:6A:C0","aux_data":"LS0tCiQkJA=="},
"aux_device_data_quota":{"max":153600,"used":9432}
}
答案 0 :(得分:1)
LUT。
您可以将数据保存在Hash中,然后提取“device_id”,执行以下操作:
device_data = { "app_data_quota":{"max":153600,"used":9432},
"aux_device_data_reference":{"reference_id":70},
"aux_device_data_in":{"device_id":"00:06:66:7C:6A:C0","aux_data":"LS0tCiQkJA=="},
"aux_device_data_quota":{"max":153600,"used":9432}
}
device_id = device_data[:aux_device_data_in][:device_id]
此致