我在PostgreSQL中有以下JSON对象。我试图写一个查询来获取“元素”的详细信息
{
"ItineraryId": 0,
"ForceSingleSearchForFlights": null,
"ExcludeBasicFareBrand": null,
"UserNodes": [
{
"User": {
"Id": "-2",
"GivenName": "Wiliam Never",
"PreferredAirport": "",
"TravelerGroupId": null,
"ExternalId": null,
"ExternalId2": null,
"CheckCCFieldForTraveler": false,
"NotificationEmailOverride": null,
"PaxType": 0,
"Title": "Dr",
"MiddleName": null,
"DateOfBirth": "1980-01-15T00:00:00Z",
"PhoneNumber": null,
"TsaInfo": null,
"Source": "RequestEndPoint",
"AllowBookingGuestTraveler": null,
"GDSTravelerProfileContainsFirstName": false,
"ProfilesFound": {
"Agency": null,
"Corporate": null,
"Traveler": null
},
"UserId": "-2",
"FirstName": "Wiliam",
"LastName": "Never"
},
"Elements": null
}
]
}
字符串
我尝试了多个查询选项,如
select itineraryintent -> 'UserNodes' ->> 'Elements' AS intent from Itinerary";
型
但我总是得到以下错误
ERROR: operator does not exist: text -> unknown
LINE 1: select itineraryintent -> 'UserNodes' AS intent from "Worksp...
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
SQL state: 42883
Character: 24
型
1条答案
按热度按时间0g0grzrc1#
按如下方式使用
json_array_elements
字符串