-1

在 Automation Anywhere 中,我们如何解析响应 REST API 调用的 json 字符串?与 UiPath 不同,AA 似乎没有 JSON 字符串的反序列化选项。

我的目标是从“searchResult”元素中提取“item”详细信息。请帮忙。

下面是我的 json 字符串:

[{"findItemsByKeywordsResponse":\[{"ack":\["Success"\],"version":\["1.13.0"\],"timestamp":\["2018-08-06T19:30:50.830Z"\],"searchResult":\[{"@count":"2","item":\[{"itemId":\["253482447437"\],"title":\["*Sealed in Box*  Verizon Apple iPhone SE 16/64GB 4.0\" Unlocked Smartphone"\],"globalId":\["EBAY-US"\],"subtitle":\["NO-RUSH 14 DAYS SHIPPING ONLY!  US LOCATION!"\],"primaryCategory":\[{"categoryId":\["9355"\],"categoryName":\["Cell Phones & Smartphones"\]}\],"galleryURL":\["http://thumbs2.ebaystatic.com/pict/253482447437404000000004_1.jpg"\],"viewItemURL":\["http://www.ebay.com/itm/Sealed-Box-Verizon-Apple-iPhone-SE-16-64GB-4-0-Unlocked-Smartphone-/253482447437?var=552665991559"\],"paymentMethod":\["PayPal"\],"autoPay":\["false"\],"postalCode":\["10002"\],"location":\["New York,NY,USA"\],"country":\["US"\],"shippingInfo":\[{"shippingServiceCost":\[{"@currencyId":"USD","__value__":"0.0"}\],"shippingType":\["Free"\],"shipToLocations":\["Worldwide"\],"expeditedShipping":\["false"\],"oneDayShippingAvailable":\["false"\],"handlingTime":\["3"\]}\],"sellingStatus":\[{"currentPrice":\[{"@currencyId":"USD","__value__":"260.99"}\],"convertedCurrentPrice":\[{"@currencyId":"USD","__value__":"260.99"}\],"sellingState":\["Active"\],"timeLeft":\["P1DT14H31M1S"\]}\],"listingInfo":\[{"bestOfferEnabled":\["false"\],"buyItNowAvailable":\["false"\],"startTime":\["2018-03-11T10:01:51.000Z"\],"endTime":\["2018-08-08T10:01:51.000Z"\],"listingType":\["StoreInventory"\],"gift":\["false"\],"watchCount":\["104"\]}\],"returnsAccepted":\["true"\],"condition":\[{"conditionId":\["1000"\],"conditionDisplayName":\["New"\]}\],"isMultiVariationListing":\["true"\],"topRatedListing":\["false"\]},{"itemId":\["401421457135"\],"title":\["Apple iPhone 7 \"Factory Unlocked\" 32GB 4G LTE iOS WiFi Smartphone"\],"globalId":\["EBAY-US"\],"subtitle":\["USA Seller - No Contract Required - Fast Shipping!!"\],"primaryCategory":\[{"categoryId":\["9355"\],"categoryName":\["Cell Phones & Smartphones"\]}\],"galleryURL":\["http://thumbs1.ebaystatic.com/pict/04040_0.jpg"\],"viewItemURL":\["http://www.ebay.com/itm/Apple-iPhone-7-Factory-Unlocked-32GB-4G-LTE-iOS-WiFi-Smartphone-/401421457135?var=0"\],"paymentMethod":\["PayPal"\],"autoPay":\["true"\],"postalCode":\["07014"\],"location":\["Clifton,NJ,USA"\],"country":\["US"\],"shippingInfo":\[{"shippingServiceCost":\[{"@currencyId":"USD","__value__":"0.0"}\],"shippingType":\["Free"\],"shipToLocations":\["Worldwide"\],"expeditedShipping":\["true"\],"oneDayShippingAvailable":\["false"\],"handlingTime":\["1"\]}\],"sellingStatus":\[{"currentPrice":\[{"@currencyId":"USD","__value__":"319.95"}\],"convertedCurrentPrice":\[{"@currencyId":"USD","__value__":"319.95"}\],"sellingState":\["Active"\],"timeLeft":\["P29DT23H2M23S"\]}\],"listingInfo":\[{"bestOfferEnabled":\["false"\],"buyItNowAvailable":\["false"\],"startTime":\["2017-10-10T18:33:13.000Z"\],"endTime":\["2018-09-05T18:33:13.000Z"\],"listingType":\["StoreInventory"\],"gift":\["false"\],"watchCount":\["9152"\]}\],"returnsAccepted":\["true"\],"condition":\[{"conditionId":\["2500"\],"conditionDisplayName":\["Seller refurbished"\]}\],"isMultiVariationListing":\["true"\],"topRatedListing":\["true"\]}\]}\],"paginationOutput":\[{"pageNumber":\["1"\],"entriesPerPage":\["6"\],"totalPages":\["2779640"\],"totalEntries":\["16677839"\]}\],"itemSearchURL":\["http://www.ebay.com/sch/i.html?_nkw=iPhone&_ddo=1&_ipg=6&_pgn=1"\]}\]}][1]
4

1 回答 1

0

Automation Anywhere 不附带默认的 JSON 解析工具。但是,它确实带有一个 DLL 库,您可以使用它来将 JSON 转换为 XML,并且 AA 可以很好地处理 XML 文档。

有问题的库是 Newtonsoft.Json.dll(您可以在 AA Client 安装目录中找到它),它有几种处理 JSON 的有用方法(请参阅此处

于 2018-08-14T17:26:35.160 回答