简体   繁体   English

我想在变量中存储(数组值的对象数组)

[英]i want store (array- of object- of array value )in variable

gstPercent: "25"
hsnCode: "856657089900"
idata: null
materialCode: "212321"
materialName: "216465132"
pricing: {pricingHistory: [
salesPricing: 1235
 ]
}
status: true 

given data给定数据

and am trying:我正在尝试:

var sellingPrice = matListOfOne.find(p => p.pricing.pricingHistory.filter(function (s){
    return s.salesPricing;
}));

The array should contain numerous sting values or objects.该数组应包含大量的字符串值或对象。

The correct json should be:正确的 json 应该是:

gstPercent: "25",
hsnCode: "856657089900",
idata: null,
materialCode: "212321",
materialName: "216465132",
pricing: {pricingHistory:[
{salesPricing: '1235'}
 ]
}

Your code should work now您的代码现在应该可以工作了

this works //storing pricing obj in varibale这有效//在变量中存储定价obj

var pricing = oneMatData.find(function (p) {
                return p.pricing;` `
            }).pricing;

var salesPricing = pricing.pricingHistory[0].salesPricing; var salesPricing = price.pricingHistory[0].salesPricing;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM