嗨,我有一个具有这种结构的json
@Autowired
所以我试图用数组中的number_week和session来检索所有星期,所以我有这个查询
"units":[ "weeks": [
{
"sessions":[
{
"subject":"",
"activities":[
{
"modality":"",
"description":"",
"type_activity":"",
"label_description":""
}
],
"number_session":1
}
],
"number_week":"1"
},
{
"sessions":[
{
"subject":"",
"activities":[
{
"modality":"",
"description":"",
"type_activity":"",
"label_description":""
}
],
"number_session":1
}
],
"number_week":"2"
},
{
"sessions":[
{
"subject":"",
"activities":[
{
"modality":"",
"description":"",
"type_activity":"",
"label_description":""
}
],
"number_session":1
}
],
"number_week":"3"
},
{
"sessions":[
{
"subject":"",
"activities":[
{
"modality":"",
"description":"",
"type_activity":"",
"label_description":""
}
],
"number_session":1
}
],
"number_week":"4"
}
]]
但不起作用。如何检索值的正确性,我有空值,但是我在表中找到了值。
select value->'weeks'->'number_week' as title
from syllabus_programs
cross join jsonb_array_elements(program_json->'units')
where id =12;
如果我只能访问value->'weeks'返回带有键和值的json,但是我不能访问该值。