>
下面有一个json响应数组,我正在将它放入Jmeter正则表达式提取器变量c_totalresponse
中。
在这里,我有cartitems
JSON对象。
在cartitems
JSON对象中,我们有不同的SKU和相应的数量。
我正在使用一个hashmap从CSV文件中读取值,并更新每个SKU的数量细节,但我的脚本无法将响应取到JMeter中的数组中。
最后,我将分享解析JSON数组时遇到的Jmeter代码和错误
我看到很多帖子建议groovy,我不知道如何使用它来获得如此巨大的响应
[{"statusCode":200,"type":"rpc","tid":7,"ref":true,"action":"ccrz.cc_ctrl_CartRD","method":"fetchMiniCart","result":{"data":{"s":1,"v":{"sfid":"a5x8E000000ICRBQA4","ownerId":"0058E000005wuxmQAA","sfdcName":"00000563","encryptedId":"b86853d1-2929-44bb-84de-826bb350ff59","activeCart":true,"cartStatus":"Open","cartType":"Cart","lastModifiedDate":1615952024000,"name":"New Cart","effectiveAccountID":"0010Y00001cdP0yQAE","b2BCCTMCCount":1,"b2BCCRYOCount":0,"b2BCCCIGARCount":0,"b2BCCOTHERCount":0,"b2BCCIsEmergency":false,"b2BCCIsOffSchedule":false,"b2BCCIsFlagged":false,"b2BCCProductCount":1,"b2BCCTotalSticks":200,"b2BCCTotalGrams":0,"b2BCCExciseRemainingGrams":199670,"b2BCCExciseRemainingSticks":97800,"b2BCCNumberOfOrdersToday":0,"b2BCCOrderingDate":1615939200000,"b2},"cartItems":{"s":55,"v":[{"s":56,"v":{"sfid":"a5w8E000000LFa5QAG","sfdcName":"00068652","cart":"a5x8E000000ICRBQA4","quantity":0,"price":330.53,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":266,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":0.00,"b2BCCAvgSales8Weeks":0.30,"b2BCCAvgSales13Weeks":0.50,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFa5QAG","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,},{"s":60,"v":{"sfid":"a5w8E000000LFa3QAG","sfdcName":"00068650","cart":"a5x8E000000ICRBQA4","quantity":0,"price":13.00,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":264,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":0.00,"b2BCCAvgSales8Weeks":0.00,"b2BCCAvgSales13Weeks":0.00,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFa3QAG","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":61,"v":{"sfid":"a6w8E00000096F3QAI","sfdcName":"WINNIES ROLLING PAPERS 50","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"9310797287227","b2BCCProductCategory":"Other","b2BCCSTMCode":"000000000050055946","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":50},"shortDesc":"WINNIES ROLLING PAPERS 50","id":"a6w8E00000096F3QAI","sku":"50055946","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":1.000000,"UnitOfMeasure":"BX","showSubscriptionSelection":false,"name":"WINNIES ROLLING PAPERS 50","price":13.00}},"qtyIncrement":1,"SubAmount":0.00,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E00000096F3QAI","ccrz__SKU__c":"50055946"}}},{"s":62,"v":{"sfid":"a5w8E000000LFa2QAG","sfdcName":"00068649","cart":"a5x8E000000ICRBQA4","quantity":0,"price":35.73,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":262,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":0.00,"b2BCCAvgSales8Weeks":0.00,"b2BCCAvgSales13Weeks":0.00,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFa2QAG","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":63,"v":{"sfid":"a6w8E00000096EtQAI","sfdcName":"CAPTAIN BLACK DARK CREMA (20) ","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"71737493045","b2BCCProductCategory":"CIGAR","b2BCCSTMCode":"000000000075002330","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":44},"shortDesc":"CAPTAIN BLACK DARK CREMA (20) ","id":"a6w8E00000096EtQAI","sku":"50050031","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":20.000000,"UnitOfMeasure":"PK","showSubscriptionSelection":false,"name":"CAPTAIN BLACK DARK CREMA (20) ","price":35.73}},"qtyIncrement":1,"SubAmount":0.00,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E00000096EtQAI","ccrz__SKU__c":"50050031"}}},{"s":64,"v":{"sfid":"a5w8E000000LFa1QAG","sfdcName":"00068648","cart":"a5x8E000000ICRBQA4","quantity":0,"price":35.73,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":261,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":0.00,"b2BCCAvgSales8Weeks":0.00,"b2BCCAvgSales13Weeks":0.00,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFa1QAG","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":65,"v":{"sfid":"a6w8E00000096EyQAI","sfdcName":"CAPTAIN BLACK CHERISE (20)","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"71737493076","b2BCCProductCategory":"CIGAR","b2BCCSTMCode":"000000000075002330","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":47},"shortDesc":"CAPTAIN BLACK CHERISE (20)","id":"a6w8E00000096EyQAI","sku":"50050070","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":20.000000,"UnitOfMeasure":"PK","showSubscriptionSelection":false,"name":"CAPTAIN BLACK CHERISE (20)","price":35.73}},"qtyIncrement":1,"SubAmount":0.00,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E00000096EyQAI","ccrz__SKU__c":"50050070"}}},{"s":66,"v":{"sfid":"a5w8E000000LFa0QAG","sfdcName":"00068647","cart":"a5x8E000000ICRBQA4","quantity":0,"price":35.73,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":260,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":0.00,"b2BCCAvgSales8Weeks":0.00,"b2BCCAvgSales13Weeks":0.00,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFa0QAG","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":67,"v":{"sfid":"a6w8E00000096ACQAY","sfdcName":"CAPTAIN BLACK CLASSIC (20)","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"71737493014","b2BCCProductCategory":"CIGAR","b2BCCSTMCode":"000000000075002330","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":32},"shortDesc":"CAPTAIN BLACK CLASSIC (20)","id":"a6w8E00000096ACQAY","sku":"50050062","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":20.000000,"UnitOfMeasure":"PK","showSubscriptionSelection":false,"name":"CAPTAIN BLACK CLASSIC (20)","price":35.73}},"qtyIncrement":1,"SubAmount":0.00,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E00000096ACQAY","ccrz__SKU__c":"50050062"}}},{"s":68,"v":{"sfid":"a5w8E000000LFZpQAO","sfdcName":"00068636","cart":"a5x8E000000ICRBQA4","quantity":0,"price":48.49,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":208,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":8.80,"b2BCCAvgSales8Weeks":11.90,"b2BCCAvgSales13Weeks":12.70,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFZpQAO","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":69,"v":{"sfid":"a6w8E000000969ZQAQ","sfdcName":"PORT ROYAL 25G RUM & WINE RYO","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"9310797281683","b2BCCProductCategory":"RYO","b2BCCSTMCode":"000000000075025978","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":29},"shortDesc":"PORT ROYAL 25G RUM & WINE RYO","id":"a6w8E000000969ZQAQ","sku":"10065793","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":25.000000,"UnitOfMeasure":"PA","showSubscriptionSelection":false,"name":"PORT ROYAL 25G RUM & WINE RYO","price":48.49}},"qtyIncrement":1,"SubAmount":0.00,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E000000969ZQAQ","ccrz__SKU__c":"10065793"}}},{"s":70,"v":{"sfid":"a5w8E000000LFZoQAO","sfdcName":"00068635","cart":"a5x8E000000ICRBQA4","quantity":0,"price":45.22,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":206,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":0.00,"b2BCCAvgSales8Weeks":0.00,"b2BCCAvgSales13Weeks":0.20,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFZoQAO","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":71,"v":{"sfid":"a6w8E000000963wQAA","sfdcName":"PORT ROYAL 25G RAW","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"9310797286466","b2BCCProductCategory":"RYO","b2BCCSTMCode":"000000000075090737","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":17},"shortDesc":"PORT ROYAL 25G RAW","id":"a6w8E000000963wQAA","sku":"10065785","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":25.000000,"UnitOfMeasure":"PA","showSubscriptionSelection":false,"name":"PORT ROYAL 25G RAW","price":45.22}},"qtyIncrement":1,"SubAmount":0.00,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E000000963wQAA","ccrz__SKU__c":"10065785"}}},{"s":72,"v":{"sfid":"a5w8E000000LFZnQAO","sfdcName":"00068634","cart":"a5x8E000000ICRBQA4","quantity":0,"price":28.79,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":204,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":0.00,"b2BCCAvgSales8Weeks":0.00,"b2BCCAvgSales13Weeks":0.00,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFZnQAO","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":73,"v":{"sfid":"a6w8E000000966vQAA","sfdcName":"PORT ROYAL 15G ORIG RUM & WINE","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"9310797283847","b2BCCProductCategory":"RYO","b2BCCSTMCode":"000000000075076853","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":26},"shortDesc":"PORT ROYAL 15G ORIG RUM & WINE","id":"a6w8E000000966vQAA","sku":"10065881","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":15.000000,"UnitOfMeasure":"PA","showSubscriptionSelection":false,"name":"PORT ROYAL 15G ORIG RUM & WINE","price":28.79}},"qtyIncrement":1,"SubAmount":0.00,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E000000966vQAA","ccrz__SKU__c":"10065881"}}},{"s":74,"v":{"sfid":"a5w8E000000LFZmQAO","sfdcName":"00068633","cart":"a5x8E000000ICRBQA4","quantity":0,"price":28.79,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":202,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":0.00,"b2BCCAvgSales8Weeks":0.00,"b2BCCAvgSales13Weeks":0.00,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFZmQAO","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":75,"v":{"sfid":"a6w8E000000966cQAA","sfdcName":"PORT ROYAL 15G HIGHLAND WHISKY","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"9310797283861","b2BCCProductCategory":"RYO","b2BCCSTMCode":"000000000075079687","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":23},"shortDesc":"PORT ROYAL 15G HIGHLAND WHISKY","id":"a6w8E000000966cQAA","sku":"10041618","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":3.000000,"UnitOfMeasure":"PA","showSubscriptionSelection":false,"name":"PORT ROYAL 15G HIGHLAND WHISKY","price":28.79}},"qtyIncrement":1,"SubAmount":0.00,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E000000966cQAA","ccrz__SKU__c":"10041618"}}},{"s":76,"v":{"sfid":"a5w8E000000LFZlQAO","sfdcName":"00068632","cart":"a5x8E000000ICRBQA4","quantity":0,"price":41.92,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":199,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":0.00,"b2BCCAvgSales8Weeks":1.30,"b2BCCAvgSales13Weeks":2.30,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFZlQAO","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":77,"v":{"sfid":"a6w8E00000096BgQAI","sfdcName":"HOLIDAY 25G BRIGHT BLUE","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"9310797281669","b2BCCProductCategory":"RYO","b2BCCSTMCode":"000000000075025968","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":38},"shortDesc":"HOLIDAY 25G BRIGHT BLUE","id":"a6w8E00000096BgQAI","sku":"10088017","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":25.000000,"UnitOfMeasure":"PA","showSubscriptionSelection":false,"name":"HOLIDAY 25G BRIGHT BLUE","price":41.92}},"qtyIncrement":1,"SubAmount":0.00,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E00000096BgQAI","ccrz__SKU__c":"10088017"}}},{"s":78,"v":{"sfid":"a5w8E000000LFZkQAO","sfdcName":"00068631","cart":"a5x8E000000ICRBQA4","quantity":0,"price":26.51,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":195,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":0.00,"b2BCCAvgSales8Weeks":0.00,"b2BCCAvgSales13Weeks":0.00,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFZkQAO","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":79,"v":{"sfid":"a6w8E00000096BhQAI","sfdcName":"CAPSTAN 15G MAKERS BLEND","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"9310797285476","b2BCCProductCategory":"RYO","b2BCCSTMCode":"000000000075087239","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":41},"shortDesc":"CAPSTAN 15G MAKERS BLEND","id":"a6w8E00000096BhQAI","sku":"10088018","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":15.000000,"UnitOfMeasure":"PA","showSubscriptionSelection":false,"name":"CAPSTAN 15G MAKERS BLEND","price":26.51}},"qtyIncrement":1,"SubAmount":0.00,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E00000096BhQAI","ccrz__SKU__c":"10088018"}}},{"s":80,"v":{"sfid":"a5w8E000000LFZFQA4","sfdcName":"00068600","cart":"a5x8E000000ICRBQA4","quantity":0,"price":188.56,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":12,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":2.50,"b2BCCAvgSales8Weeks":4.10,"b2BCCAvgSales13Weeks":4.20,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFZFQA4","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":81,"v":{"sfid":"a6w8E000000965pQAA","sfdcName":"B&H 30/120 SMOOTH BLUE","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"9310797285537","b2BCCProductCategory":"TMC","b2BCCSTMCode":"000000000075089380","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":20},"shortDesc":"B&H 30/120 SMOOTH BLUE","id":"a6w8E000000965pQAA","sku":"10086360","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":120.000000,"UnitOfMeasure":"CT","showSubscriptionSelection":false,"name":"B&H 30/120 SMOOTH BLUE","price":188.56}},"qtyIncrement":1,"SubAmount":0.00,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E000000965pQAA","ccrz__SKU__c":"10086360"}}},{"s":82,"v":{"sfid":"a5w8E000000LFZEQA4","sfdcName":"00068599","cart":"a5x8E000000ICRBQA4","quantity":0,"price":188.56,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":11,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":3.00,"b2BCCAvgSales8Weeks":4.00,"b2BCCAvgSales13Weeks":4.60,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFZEQA4","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":83,"v":{"sfid":"a6w8E00000096BVQAY","sfdcName":"B&H 30/120 CLASSIC RED","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"9310797285520","b2BCCProductCategory":"TMC","b2BCCSTMCode":"000000000075089380","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":35},"shortDesc":"B&H 30/120 CLASSIC RED","id":"a6w8E00000096BVQAY","sku":"10086472","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":120.000000,"UnitOfMeasure":"CT","showSubscriptionSelection":false,"name":"B&H 30/120 CLASSIC RED","price":188.56}},"qtyIncrement":1,"SubAmount":0.00,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E00000096BVQAY","ccrz__SKU__c":"10086472"}}},{"s":84,"v":{"sfid":"a5w8E000000LFZDQA4","sfdcName":"00068598","cart":"a5x8E000000ICRBQA4","quantity":0,"price":330.53,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":9,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":0.50,"b2BCCAvgSales8Weeks":0.90,"b2BCCAvgSales13Weeks":0.90,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFZDQA4","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":85,"v":{"sfid":"a6w8E0000009632QAA","sfdcName":"B&H 25/200 FINE GREY FF","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"9310797002615","b2BCCProductCategory":"TMC","b2BCCSTMCode":"000000000075001150","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":14},"shortDesc":"B&H 25/200 FINE GREY FF","id":"a6w8E0000009632QAA","sku":"10014887","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":200.000000,"UnitOfMeasure":"CT","showSubscriptionSelection":false,"name":"B&H 25/200 FINE GREY FF","price":330.53}},"qtyIncrement":1,"SubAmount":0.00,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E0000009632QAA","ccrz__SKU__c":"10014887"}}},{"s":86,"v":{"sfid":"a5w8E000000LFZBQA4","sfdcName":"00068596","cart":"a5x8E000000ICRBQA4","quantity":1,"price":330.53,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":330.53,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":6,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":0.00,"b2BCCAvgSales8Weeks":0.30,"b2BCCAvgSales13Weeks":0.50,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFZBQA4","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":87,"v":{"sfid":"a6w8E000000962OQAQ","sfdcName":"B&H 25/200 SMOOTH DRK BLUE FF","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"9310797002516","b2BCCProductCategory":"TMC","b2BCCSTMCode":"000000000075001150","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":5},"shortDesc":"B&H 25/200 SMOOTH DRK BLUE FF","id":"a6w8E000000962OQAQ","sku":"10014748","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":200.000000,"UnitOfMeasure":"CT","showSubscriptionSelection":false,"name":"B&H 25/200 SMOOTH DRK BLUE FF","price":330.53}},"qtyIncrement":1,"SubAmount":330.53,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E000000962OQAQ","ccrz__SKU__c":"10014748"}}},{"s":88,"v":{"sfid":"a5w8E000000LFZAQA4","sfdcName":"00068595","cart":"a5x8E000000ICRBQA4","quantity":0,"price":330.53,"productType":"Product","storeID":"B2BAUSECOMMERCE","pricingType":"auto","itemTotal":0.00,"cartItemType":"Major","itemStatus":"Available","b2BCCSubAmountDiscount":0.00,"b2BCCIsFeatured":false,"b2BCCIsStrategic":false,"b2BCCSequence":5,"b2BCCPromotionTotal":0.00,"b2BCCPromotionZSC1":0.00,"b2BCCPromotionZSM1":0.00,"b2BCCPromotionZSP1":0.00,"b2BCCPromoCappingOverflowPrice":0.00,"b2BCCPromoCappingOverflowQty":0,"b2BCCAvgSales4Weeks":1.00,"b2BCCAvgSales8Weeks":1.60,"b2BCCAvgSales13Weeks":2.10,"sfdcCurrencyISOCode":"AUD","itemID":"a5w8E000000LFZAQA4","cartId":"a5x8E000000ICRBQA4","showSubProdTerm":false,"mockProduct":{"s":89,"v":{"sfid":"a6w8E000000962YQAQ","sfdcName":"B&H 25/200 CLASSIC RED FF","ownerId":"0058E000007MQgfQAG","storefront":"B2BAUSECOMMERCE","startDate":1577836800000,"endDate":7258032000000,"averageRating":0.00,"taxable":false,"inventoryType":"STANDARD","b2BCCBarcode":"9310797002011","b2BCCProductCategory":"TMC","b2BCCSTMCode":"000000000075001150","sfdcCurrencyISOCode":"GBP","EProductMediasS":{"r":8},"shortDesc":"B&H 25/200 CLASSIC RED FF","id":"a6w8E000000962YQAQ","sku":"10014816","ProductType":"Product","ProductStatus":"Released","qtyPerUnit":200.000000,"UnitOfMeasure":"CT","showSubscriptionSelection":false,"name":"B&H 25/200 CLASSIC RED FF","price":330.53}},"qtyIncrement":1,"SubAmount":0.00,"adjustment":0,"baseDiscount":0,"absoluteDiscount":0,"product":{"Id":"a6w8E000000962YQAQ","ccrz__SKU__c":"10014816"}}}]},"cartItemCount":1}},"inputContext":{"currentCartId":"b86853d1-2929-44bb-84de-826bb350ff59","currentPageName":"ccrz__ProductList","currentPageURL":"https://batuat-batglobalb2b.cs87.force.com/B2BAUSECOMMERCE/ccrz__ProductList?effectiveAccount=0010Y00001cdP0yQAE&refURL=https%3A%2F%2Fbatuat-batglobalb2b.cs87.force.com%2FB2BAustraliaCommunity%2Fs%2F","effAccountId":"0010Y00001cdP0yQAE","portalUserId":"","priceGroupId":"","queryParams":{"s":90,"v":{}},"storefront":"B2BAUSECOMMERCE","userIsoCode":"AUD","userLocale":"en_US"},"messages":{"s":91,"v":[]},"success":true}}]
下面是我在Jmeter中提到的步骤的代码
import org.apache.jmeter.threads.JMeterContext.TestLogicalAction;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Scanner;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import groovy.json.JsonSlurper;
import org.json.JSONArray;
import org.json.JSONObject;
import com.eclipsesource.json.*;
String Path = "\\\\fjsvdishares\\85039042\\Documents\\2021\\J-Meter\\data.csv";
try
{
String test = org.apache.commons.io.FileUtils.readFileToString(new File(Path));
Map map = new HashMap();
map.put(vars.get("SKU"),vars.get("quantity"));
JSONParser jsonParser = new JSONParser();
JSONArray cartItemsList = null;
JSONObject cartItemsObj = null;
String jsonString = vars.get("C_Totalresponse");
JSONObject cartItemsObj = (JSONObject) jsonParser.parse(jsonString);
SONArray cartItemsList = (JSONArray) cartItemsObj.get("cartItems");
Iterator it = map.entrySet().iterator();
while (it.hasNext() ) {
Map.Entry pair = (Map.Entry)it.next();
if(cartItemsList.size() > 0 ) {
for(int i = 0; i < cartItemsList.size(); i++){
JSONObject object = (JSONObject) cartItemsList.get(i);
JSONObject productJsonObj = (JSONObject)object.get("product") ;
if( productJsonObj.get("ccrz__SKU__c").toString() .equals(pair.getKey().toString()) ) {
object.put("quantity" , pair.getValue());
}
}
}
}
}
catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
2021-03-17 07:42:03,146错误O.A.J.E.JSR223PostProcessor:JSR223脚本中的问题,JSR223 PostProcessor javax.script.ScriptException:源文件:内联计算:import org.apache.jmeter.samplers.sampleresult;导入org.apache.jmeter.threads。..'':类型化变量声明:第48行:文件中:内联计算:
导入org.apache.jmeter.samplers.sampleresult;导入org.apache.jmeter.threads。..'':(JSONObject)jsonParser.Parse(jsonString)
目标异常:java.lang.ClassCastException:无法在:``Import org.apache.jmeter.samplers.sampleresult的内联计算中将org.json.simple.jsonArray转换为org.json.jsonObject;导入org.apache.jmeter.threads。...“在第48行
我认为这一行是有问题的(至少)
JSONObject cartItemsObj = (JSONObject) jsonParser.parse(jsonString)
我相信您需要将其更改为:
JSONArray cartItemsObj = (JSONArray ) jsonParser.parse(jsonString)
我无法进一步评论您的代码,因为您的JSON是无效的,并且不太清楚您想要实现什么。
关于使用Groovy,这是您应该真正考虑的,因为:
我使用groovy JSR223 Post processor处理响应并保存到文件中。 下面是我的配置
问题内容: 我有一个页面作为HtmlUnit中的UnexpectedPage返回,响应为JSON。我可以使用HTMLUnit进行解析还是需要一个额外的库? 问题答案: HtmlUnit不支持它。它最多可以执行JS函数。您需要事先检查返回的响应是否匹配,然后使用合适的工具进行解析。Google Gson 在此方面很有用。 如果JSON结构是事先已知的,则您甚至可以使用Gson将其转换为完全有价值的J
我知道类似的帖子,我也检查过,但没有一个能帮到我。 我想POST到一个需要三个参数和一个基本身份验证的API(管理示例任务)。在postman中它可以工作。我提供的正文如下: 并设置基本身份验证(使用用户名和密码)。API发送如下响应: 如果我向api发送POST,一切都很好,但现在我想在java中实现它。如果我尝试发送一个POST: HttpClientErrorException: 400错误
问题内容: 我有一个Json文件,其中有一个字段需要编辑和保存以供下次使用。 但是我需要编辑的字段如下所示, 我需要分配该字段的值是在运行时随机生成的,我将在一个变量中捕获该变量并将其传递给此json特定键“ dp”,然后保存json。 保存的json将用于REST POST网址。 问题答案: 最简单的解决方案是编写一个可以为您更改值的python关键字。但是,您可以通过执行以下步骤来使用机器人关
问题内容: 我在弄清楚如何从jQuery $ .post()请求中正确读取JSON响应时遇到了麻烦。 在下面的jQuery代码中,我根据对应的“ color_entry_id”(用作键)从DOM中的元素填充字符串的关联数组: 然后,我发出POST请求,发送“ image_links”数组: 另外,如上所示,我尝试遍历响应数组并输出要成为字符串的每个项目,但是我只得到“ [object Object
我需要测试rest api发布JSON。我尝试使用JMeter通过BeanShell后处理器发布Json数据。但是BeanShell后处理器不工作或者我写不出正确的代码。 我的Json是:{“email”:“selin@xxx.com”,“password”:“123”} 你可以在下面的图片中看到我做了什么。