Я пытаюсь извлечь информацию из столбца, содержащего данные json.
Вот пример:
statushistory idorder
[{"timestamp":"2016-10-10T14:42:23.386Z","status":"unassigned"},{"timestamp":"2016-10-10T07:21:08.634Z","status":"baseline"},{"timestamp":"2016-10-11T08:36:55.882Z","status":"inTransit"},{"timestamp":"2016-10-10T11:03:36.491Z","status":"toReschedule"},{"timestamp":"2016-10-11T07:30:56.897Z","status":"baseline"},{"timestamp":"2016-10-10T08:07:36.500Z","status":"inTransit"},{"timestamp":"2016-10-10T11:11:20.489Z","status":"committed"},{"timestamp":"2016-10-10T05:59:45.761Z","status":"unassigned"},{"timestamp":"2016-10-11T12:15:25.975Z","status":"fulfilled"},{"timestamp":"2016-10-11T12:16:25.766Z","status":"fulfilled"},{"timestamp":"2016-10-10T11:02:36.442Z","status":"toReschedule"}] 281474981556785
[{"timestamp":"2016-10-11T12:40:29.373Z","status":"toReschedule"},{"timestamp":"2016-10-11T12:41:29.710Z","status":"toReschedule"},{"timestamp":"2016-10-11T07:30:57.231Z","status":"baseline"},{"timestamp":"2016-10-11T14:26:45.995Z","status":"rescheduled"},{"timestamp":"2016-10-11T08:36:59.080Z","status":"inTransit"},{"timestamp":"2016-10-10T14:42:23.387Z","status":"unassigned"}] 281474983220313
[{"timestamp":"2016-10-11T14:03:28.137Z","status":"baseline"},{"timestamp":"2016-10-11T19:37:44.172Z","status":"rescheduled"},{"timestamp":"2016-10-11T18:44:33.473Z","status":"toReschedule"},{"timestamp":"2016-10-10T14:42:23.385Z","status":"unassigned"},{"timestamp":"2016-10-11T18:45:35.284Z","status":"toReschedule"},{"timestamp":"2016-10-11T14:39:34.867Z","status":"inTransit"}] 281474983332443
[{"timestamp":"2016-10-11T08:21:59.122Z","status":"rescheduled"}] 281474983118369
[{"timestamp":"2016-10-11T10:40:25.666Z","status":"fulfilled"},{"timestamp":"2016-10-10T14:42:23.386Z","status":"unassigned"},{"timestamp":"2016-10-11T10:39:25.888Z","status":"fulfilled"},{"timestamp":"2016-10-11T07:30:56.971Z","status":"baseline"},{"timestamp":"2016-10-11T08:36:56.033Z","status":"inTransit"}] 281474982795357
[{"timestamp":"2016-10-10T14:42:23.386Z","status":"unassigned"},{"timestamp":"2016-10-11T14:03:20.803Z","status":"baseline"},{"timestamp":"2016-10-11T16:19:27.735Z","status":"fulfilled"},{"timestamp":"2016-10-11T14:39:30.396Z","status":"inTransit"},{"timestamp":"2016-10-11T16:18:26.816Z","status":"fulfilled"}] 281474981917259
[{"timestamp":"2016-10-11T09:25:26.100Z","status":"fulfilled"},{"timestamp":"2016-10-10T14:42:23.386Z","status":"unassigned"},{"timestamp":"2016-10-11T08:36:56.132Z","status":"inTransit"},{"timestamp":"2016-10-11T07:30:56.979Z","status":"baseline"},{"timestamp":"2016-10-11T09:26:26.241Z","status":"fulfilled"}] 281474981917255
Я пытаюсь получить для каждой строки значения для "статус "и" метка времени ".Я не могу понять, как я могу выделить эти две информации для каждой строки.
Я пытался с:
select
statushistory::json -> 'status',
statushistory::json -> 'timestamp',
idorder
from json_data;
Но это дает мне только полностью пустой столбец.
Я пытаюсь получить что-то вроде этого:
status timestamp idorder
inStock xxx id1
failed yyy id1
toReschedule zzz id2
Я что-то не так делаю?