java根据行号从数组列表中获取JSON对象
我正在用intellij idea进行开发。这里我的要求是在编辑器中打开一个json文件,并且我的光标位于特定的行上。我能够找到行号,现在我的下一个任务是,从json文件(它是一个对象数组)中获取整个对象,我的光标就在这里。例如,这是我的json
[{
"facility": "Global",
"group_names": [
"H R"
],
"group_type": "department",
"remove_users_on_logout": false,
"shift_membership": {
"min": 50,
"max": 50,
"source": "any_shift",
"type": [
"auxiliary"
]
},
"child_members": [{
"diamond": {
"diamond_id": "akron_hr"
}
}]
},
{
"facility": "Global",
"group_names": [
"I T"
],
"group_type": "department",
"remove_users_on_logout": false,
"shift_membership": {
"min": 40,
"max": 40,
"source": "per_shift",
"type": [
"auxiliary"
]
},
"child_members": [{
"diamond": {
"diamond_id": "akron_it"
}
},
{
"diamond": {
"diamond_id": "baltimore_it"
}
}
]
}
]
例如,如果我在从1到21的任何一行上,我的输出应该是
{
"facility": "Global",
"group_names": [
"H R"
],
"group_type": "department",
"remove_users_on_logout": false,
"shift_membership": {
"min": 50,
"max": 50,
"source": "any_shift",
"type": [
"auxiliary"
]
},
"child_members": [{
"diamond": {
"diamond_id": "akron_hr"
}
}]
}
谁能告诉我什么方法可以帮助我?谢谢你的帮助。谢谢
共 (0) 个答案