local jsonCutil = CTNJsonUtil();
local sJsonTest = [[
{
"json_demo": [
{
"key1": "test_name_1",
"value2": "test_VALUE_1"
},
{
"key1": "test_name_2",
"value2": "test_VALUE_2"
},
{
"key1": "test_name_3",
"value2": "test_VALUE_3"
}
]
}
]]
local sKeyAdd = 'add_key'
local sValueAdd = 'add_value'
local helpTree = CSelectHelp();
if jsonCutil:fromString(sJsonTest) == true then
jsonCutil:addNode(sKeyAdd, sValueAdd);
jsonCutil:toTreeHelp(helpTree);
end
local itIn = CIntent();
itIn:set('initadd1','init_value_1');
itIn:set('initadd2','init_value_2');
itIn:set('initadd3','init_value_3');
if jsonCutil:fromString(sJsonTest) == true then
jsonCutil:addItent('InItDemoCol',itIn);
jsonCutil:toTreeHelp(helpTree);
end
local sql_select = [[
select
material_type_id,material_type_name,material_type_full_name,
parent_material_type_id,create_by_name
from bs_material_type where is_delete = 0
]];
local helpSelect = CSelectHelp();
if db:select(sql_select, '', helpSelect) < 0 then
ui:tip(db:error());
return;
end
jsonCutil:addHelp('helpAddCol',helpSelect);
jsonCutil:toTreeHelp(help);
m_pGrid:setHelp(help);
local sSaveFilePath = [[E:\test_class\6.txt]]
if jsonCutil:fromString(sJsonTest) == true then
if jsonCutil:toFile(sSaveFilePath) == true then
print('保存成功');
end
end
if jsonCutil:fromString(sJsonTest) == true then
jsonCutil:clear();
print(jsonCutil:toString());
end