Exemple #1
0
    void Test()
    {
        TestForm testForm = new TestForm();

        testForm.number = 123;
        testForm.text   = "456";

        testForm.lowerTest = new LowerTest[3];

        LowerTest lower = new LowerTest();

        lower.lowerLevel      = 21;
        lower.lowerName       = "lower";
        testForm.lowerTest[0] = lower;
        testForm.lowerTest[2] = lower;

        string json = JsonMapper.ToJson(testForm);

        Debug.LogError("Json: " + json);

        Debug.LogError("");

        TestForm result = JsonMapper.ToObject <TestForm>(json);

        Debug.LogError("Number = " + result.number + "   text = " + result.text);
        Debug.LogError("Lower[0]= " + JsonMapper.ToJson(result.lowerTest[0]));
        Debug.LogError("Lower[1]= " + result.lowerTest[1]);
        Debug.LogError("Lower[2]= " + JsonMapper.ToJson(result.lowerTest[0]));
    }
Exemple #2
0
    void Test()
    {
        TestForm testForm = new TestForm();
        testForm.number = 123;
        testForm.text = "456";

        testForm.lowerTest = new LowerTest[3];

        LowerTest lower = new LowerTest();
        lower.lowerLevel = 21;
        lower.lowerName = "lower";
        testForm.lowerTest[0] = lower;
        testForm.lowerTest[2] = lower;

        string json = JsonMapper.ToJson(testForm);
        Debug.LogError("Json: " + json);

        Debug.LogError("");

        TestForm result = JsonMapper.ToObject<TestForm>(json);
        Debug.LogError("Number = " + result.number + "   text = " + result.text);
        Debug.LogError("Lower[0]= " + JsonMapper.ToJson(result.lowerTest[0]));
        Debug.LogError("Lower[1]= " + result.lowerTest[1]);
        Debug.LogError("Lower[2]= " + JsonMapper.ToJson(result.lowerTest[0]));
    }