【发布时间】:2019-03-13 04:59:05
【问题描述】:
我需要从 JSON 格式中获取数组中的最后一项。我有这个 JSON。
@json =
N'{
"solution": "xxxxxxxxxxxxxxxxxxxxx",
"options": [
{
"choice_id": 205073,
"choice": "aaaa"
},
{
"choice_id": 205074,
"choice": "bbbb"
},
{
"choice_id": 205075,
"choice": "cccc"
},
{
"choice_id": 205076,
"choice": "dddd"
}
],
}'
我想得到
@json =
N'{
"solution": "xxxxxxxxxxxxxxxxxxxxx",
"options": {
"choice_id": 205076,
"choice": "dddd"
}
}
我怎样才能达到这个结果?
【问题讨论】:
-
拥有 4k 声望,您应该已经对 How to Ask 相当熟悉 - 您需要向我们展示您的尝试。
-
@ZoharPeled 这就是重点,我没有尝试过任何东西,因为我不知道如何...... sql 中的这个 JSON 东西对我来说很新,我找不到任何可以帮助我实现的信息那个。
-
嗯,你应该从reading the documentation...开始
-
@ZoharPeled 我做到了,找不到与我想要实现的目标相关的任何内容
-
你怎么知道你想要
"choice": "dddd"的记录?
标签: json sql-server tsql sql-server-2016