Code: Select all
Function p_SaveXLSX()
Local f$ = moai.Get("file", "text")
Local mTable = {}
If f$ <>""
;convert json file into table
mTable = DeserializeTable(FileToString(f$), "Default")
;convert table into XLSX file
Local fname$ = UnleftStr(FilePart(f$), 5)..".xlsx"
Local s$ = FileRequest("Save XLSX", {Filters="xlsx", Mode=#REQ_SAVEMODE, File=fname$})
;StringToFile(SerializeTable(mTable, "xlsx"), s$)
OpenFile(1, s$, #MODE_WRITE)
WriteTable(1, mTable, {Adapter="xlsx"})
CloseFile(1)
EndIf
EndFunction
This is a json that i need to convert:
Code: Select all
{
"mod_name": "MOD Test 2020",
"mod_url": "http://filedn.eu/lM8guATtwL9pUR2zqpEfSVF/mod1/files",
"mod_version": "1.00",
"mod_date": "03/07/2020"
}