Is there any way to extract pure JSON data from serialized JSON

Posted by: tarun.softengg on 7 July 2021, 11:09 am EST

    • Post Options:
    • Link

    Posted 7 July 2021, 11:09 am EST

    What I am looking for is to extract data JSON objects like I want to get column values before I export/download this worksheet

    we have this big serialized JSON but is there any way to extract pure JSON data for a column?

    	function exportSheet() {
    		const spread = _spread;
    		const fileName = 'SalesData.xlsx';
    		const excelIO = new Excel.IO();
    		const json = JSON.stringify(
    			spread.toJSON({
    				includeBindingSource: true,
    				columnHeadersAsFrozenRows: true
    			})
    		);
    		console.log(json);
    
    		excelIO.save(
    			json,
    			(blob) => {
    				saveAs(blob, fileName);
    			},
    			function(e) {
    				console.log(e);
    			}
    		);
    	}
    
  • Posted 8 July 2021, 7:57 am EST

    Hi Tarun,

    If I understand correctly you want to get data of a column. For this, you may use get array method. Please refer to the following code snippet and let us know if you face any issues.

    
    //get data Array of Column index 1
    let sheet = spread.getSheet(0);
    sheet.getArray(0,1,sheet.getRowCount(),1)
    
    

    getArray method: https://www.grapecity.com/spreadjs/docs/v14/online/SpreadJS~GC.Spread.Sheets.Worksheet~getArray.html

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels