Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        TestData data = new TestData();

        //data.Main = 2048;
        //data.name = "你们好吗!";
        //data.obj.a = 9;
        //data.a = 7;
        //data.d = 2;

        Debug.Log("origin:" + Dumper.DumpAsString(data));
        string json = JsonHelper.ToJson(data);

        Debug.Log("json:" + json);
        File.WriteAllText("./test.json", json);
        TestData data1 = JsonHelper.FromJson <TestData>(json);

        Debug.Log("data1:" + Dumper.DumpAsString(data1));

        string litJson = JsonMapper.ToJson(data);

        Debug.Log($"litJson:{litJson}");
        TestData data2 = JsonMapper.ToObject <TestData>(litJson);

        Debug.Log($"data2:{Dumper.DumpAsString(data2)}");
    }
Example #2
0
    // Start is called before the first frame update
    void Start()
    {
        TestData data = new TestData();

        Debug.Log(Dumper.DumpAsString(data));
    }