按键精灵_JSON修改配置

Import "File.lua"

/**********************************************
JSON常用函数封装
***********************************************/
Dim date_path= "/sdcard/Pictures/Aj_Config/date"
Function 修改JSON参数(text,value)
  dim config=File.read(date_path)	//读取配置文件
  //	Dim name="记录文本" //修改参数
  Dim name=CStr(text)	
  If UTF8.InStr(1,config, name) > 0 Then //找到指定参数
  Dim table=Encode.JsonToTable(config)  //新定义为table
  table[name] = CStr(value)//修改table表值
    Dim json=Encode.TableToJson(Table) //新定义为Json
    Call File.Write(date_path, json)  //保存
    Else
    TracePrint "没找到记录文本"
    End If
End Function
//Call 修改JSON参数("记录文本","123")

 

赞 (0)