Dataset to simplified Json

We need to have a dataset converted to simplified JSON and the JSON must be written to a tag in the tag database. Also need to update the unicode to quotations. I was trying to save to a document tag.
the code I have so far.

tagpath = ("[default]path/memorytag")
data1 = system.tag.readBlocking(["[default]path/table"])[0].value
		# convert the incoming value data
	
	pyDataset = system.dataset.toPyDataSet(data1)
	columns = system.dataset.getColumnHeaders(pyDataset)
		
	data = []
	
	
	for row in pyDataset:
		rowMap = {}
		for col in columns:
			rowMap[col] = row[col]
		data.append(rowMap)	
	
	system.tag.writeBlocking(tagpath,[data])

Thank you in advance for your help.

	convertedArry = []
	for row in range(dataset.getRowCount()):
		convertedRow={}
		for col in dataset.getColumnNames():
			convertedRow[col] = dataset.getValueAt(row, col)
		convertedArry.append(convertedRow)
	toJsonString=system.util.jsonEncode(convertedArry)
	
2 Likes

Thank you solution worked perfectly!