1
的第一次出现所以我有一个JSON文件是这样的:JSONPath“采集”
{
"cards": [
{
"artist": "Steve Argyle",
"images": {
"mtgimage": "http://mtgimage.com/set/pMPR/ponder.jpg"
},
},
{
"artist": "Mark Tedin",
"images": {
"gatherer": "http://gatherer.wizards.com/Handlers/Image.ashx?type=card&multiverseid=139512",
"mtgimage": "http://mtgimage.com/set/LRW/ponder.jpg"
},
},
{
"artist": "Dan Scott",
"images": {
"gatherer": "http://gatherer.wizards.com/Handlers/Image.ashx?type=card&multiverseid=190159",
"mtgimage": "http://mtgimage.com/set/M10/ponder.jpg"
},
}
]
}
我想用JSONPath从它那里得到的第一个“采集”链接。 我试过“$ .. gatherer [0]”,但这不起作用。然而,“$ .. gatherer”的确提供了两种情况:
[
"http:\/\/gatherer.wizards.com\/Handlers\/Image.ashx?type=card&multiverseid=139512",
"http:\/\/gatherer.wizards.com\/Handlers\/Image.ashx?type=card&multiverseid=190159"
]
我如何获得第一个? (没有得到在代码中的最后一个,所以只有使用jsonpath字符串)。
(测试用http://jsonpath.curiousconcept.com/,在我的计划。)
这应该确实有效。不过,我正在寻找一个仅限jsonpath的解决方案。这个想法是用户可以输入他们自己的jsonpath字符串。获得第一个“收集者”链接是我期望需要使用的。所以我希望有一个不需要代码的解决方案,只需要一个jsonpath字符串即可完成。 –