-- 定义一个CTNJsonUtil类实例
local jsonCutil = CTNJsonUtil();
local help = CSelectHelp();
local sFilePath = [[E:/test_class/3.txt]];
-- 3.txt 文件内容
-- [[
    {
        "json_demo": [
            {
                "appName": "test_name_1",
                "appValue": "test_VALUE_1"
            },
            {
                "appName": "test_name_2",
                "appValue": "test_VALUE_2"
            },
            {
                "appName": "test_name_3",
                "appValue": "test_VALUE_3"
            }
        ]
    }
]]


-- 从文件加载
if jsonCutil:fromFile(sFilePath) == true then
    -- 转化成树型help
    jsonCutil:toTreeHelp(help);
end

-- 从文件中加载,并转化成字符串
if jsonCutil:fromFile(sFilePath) == true then
    -- 转化成字符串
    print(jsonCutil:toString());
end
Copyright © TouchNet 2015 all right reserved,powered by Gitbook最后修订时间: 2022-06-21 09:21:04

results matching ""

    No results matching ""