用 EvaluateJsonPath 和 SplitJson 取出{ "bulletinBoard": { "bulletins": [ { "id": 9180741, "groupId": "983e394a-ca1c-1038-2900-208da5a71496", "sourceId": "acc63c13-9181-1e96-f3f7-15542aeb761b", "timestamp": "11:14:42 CST", "canRead": true, "bulletin": { "id": 9180741, "category": "Log Message", "groupId": "983e394a-ca1c-1038-2900-208da5a71496", "sourceId": "acc63c13-9181-1e96-f3f7-15542aeb761b", "sourceName": "SplitJson", "level": "ERROR", "message": "SplitJson[id=acc63c13-9181-1e96-f3f7-15542aeb761b] The evaluated value {bulletinBoard={bulletins=[], generated=11:14:36 CST}} of $ was not a JSON Array compatible type and cannot be split.", "timestamp": "11:14:42 CST" } } ], "generated": "11:14:59 CST" } }
时间: 2023-08-11 20:08:09 浏览: 47
您可以使用EvaluateJsonPath和SplitJson来提取所需的内容。
首先,使用EvaluateJsonPath函数来提取message字段的值:
EvaluateJsonPath(json, "$.bulletinBoard.bulletins[0].bulletin.message")
这将返回以下值:
"SplitJson[id=acc63c13-9181-1e96-f3f7-15542aeb761b] The evaluated value {bulletinBoard={bulletins=[], generated=11:14:36 CST}} of $ was not a JSON Array compatible type and cannot be split."
接下来,使用SplitJson函数将message字段的值按照指定的分隔符进行拆分。假设您希望按照空格进行拆分,可以使用以下表达式:
SplitJson(message, " ")
这将返回一个数组,包含拆分后的各个部分。根据您提供的示例,拆分后的结果如下:
[
"SplitJson[id=acc63c13-9181-1e96-f3f7-15542aeb761b]",
"The",
"evaluated",
"value",
"{bulletinBoard={bulletins=[],",
"generated=11:14:36",
"CST}}",
"of",
"$",
"was",
"not",
"a",
"JSON",
"Array",
"compatible",
"type",
"and",
"cannot",
"be",
"split."
]
希望这可以帮助到您!