script for XML to JSON Parser

The following code can be used to convert XML to JSON. define([“require”, “exports”, “N/xml”], function (require, exports, xmlModule) {    “use strict”;     Object.defineProperty(exports, “__esModule”, { value: true });     exports.xml2json = exports.nsXMLToJSON = exports.xmlToJson = void 0;     //https://stackoverflow.com/a/57735605     const xmlToJson = (xmlString) => {        … Continue reading script for XML to JSON Parser

Parse XML to JSON using NetSuite ‘N/xml’ module

Create a helper.js file so the function can be shared across different scripts. /**  * @NApiVersion 2.1  */ /************************************************************************************************  * * Parse XML **  *  *  * **********************************************************************************************  *  * Author: Jobin and Jismi IT Services  *  * Date Created : 29-August-2022  *  * Created By: Manu Antony  *  * Description : Custom module for parsing XML… Continue reading Parse XML to JSON using NetSuite ‘N/xml’ module

Parse XML to JSON without using any DOM or NetSuite functions

Following is a library/function to Parse XML data to JSON without using any DOM or NetSuite functions Library File :     const xml2json = {         parser: function (xmlcode, ignoretags = [], debug = false) {             xmlcode = xmlcode.replace(/s*/>/g, ‘/>’);          … Continue reading Parse XML to JSON without using any DOM or NetSuite functions