| XPath | JSONPath | Description |
|---|---|---|
| / | $ | the root object/element |
| . | @ | the current object/element |
| / | . or [] | child operator |
| .. | n/a | recursive descent. JSONPath borrows this syntax from E4X. |
| // | [] | wildcard. All objects/elements regardless their names. |
| * | * | wildcard. All objects/elements regardless their names. |
| @ | n/a | attribute access. JSON structures don't have attributes. |
| [] | [] | subscript operator. XPath uses it to iterate over element collections and for predicates. In Javascript and JSON it is the native array operator. |
| | | [,] | Union operator in XPath results in a combination of node sets. JSONPath allows alternate names or array indices as a set. |
| n/a | [start:end:step] | array slice operator borrowed from ES4. |
| [] | ?() | applies a filter (script) expression. |
| n/a | () | script expression, using the underlying script engine. |
| () | n/a | grouping in Xpath |
JObject.SelectToken("ok") // [True]
JObject.SelectToken("channels[0].name") // [채널명]
[
{
"id": "example_id1",
"name": "uipath_rpa1",
},
{
"id": "example_id2",
"name": "uipath_rpa2",
},
...
]
# VB.NET
JObject.SelectToken("[0].id") // [example_id1] <JValue>
JObject.SelectToken("[1].id") // [example_id2] <JValue>
JObject.SelectToken("$..[?(@.name=='uipath_rpa1')]") // <JObject>
JObject.SelectToken("$..[?(@.name=='uipath_rpa1')]").SelectToken("id") // [example_id1] <JValue>
# Multiple selct case (slack channel response)
responseConversationList("channels").SelectTokens("[0].id")
responseConversationList("channels").SelectTokens("[0].name")
responseConversationList("channels").SelectTokens("..name")
responseConversationList("channels").SelectTokens("..id")
responseConversationList("channels").SelectTokens("..name")
responseConversationList("channels").SelectTokens("..is_private")
출처 & 참고 링크