Ive got this JSON object Im trying loop through which is returned via a Netsuite script.
its returning a JSON object that has some child elements.
Im trying to get the caption for classnoheirachy - name data, but everything im just not sure how to get the inner most child.
Id like to know how in javascript I can output the classnoheirachy - name and classnoheiracy-internalId
My code is below for how im looping it at the moment, but if anyone knows how i can get the items above into this newly created array that would be greatly appreciated.
var rs = nlapiSearchRecord('item', 'customsearch_pm_item_record_loader', itemFilters);
response.write(JSON.stringify(rs));
var retObj = [];
for ( var i = 0; rs != null && i < rs.length; i++) {
var rowObj = {};
rowObj.LOCATION = rs[i].getValue('location');
rowObj.LOCATION_AVAILABLE = rs[i].getValue('locationquantityavailable');
rowObj.CLASS = rs[i].getValue('classnohierarchy');
rowObj.CURRENCY = rs[i].getValue('currency', 'pricing');
rowObj.UNIT_PRICE = rs[i].getValue('unitprice', 'pricing');
rowObj.LOCATION_ON_HAND = rs[i].getValue('locationquantityonhand');
rowObj.ITEM = rs[i].getValue('itemid');
rowObj.ITEM_NAME = rs[i].getValue('itemid');
rowObj.PRICE_LEVEL = rs[i].getValue('pricelevel', 'pricing');
rowObj.ITEM_DESCRIPTION = rs[i].getValue('salesdescription');
retObj.push(rowObj);
}
Try something like:
rowObj.Name = rs[i]['columns']['classnohierarchy']['name'];
rowObj.InternalId = rs[i]['columns']['classnohierarchy']['internalid'];
See Fiddle Here for an example
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.