Example #1
0
    void Test6()
    {
        string      jsonString     = "{\"nested\":{\"nested_arr\":[{\"name\":\"vic\",\"id\":0},{\"name\":\"yuan\",\"id\":1000}],\"nested_test\":{\"nesteds\":[{\"name\":\"vic\",\"id\":0},{\"name\":\"yuan\",\"id\":1000},{\"name\":\"pepe\",\"id\":-30}]}}}";
        TestObject6 expectedResult = new TestObject6(new NestedObject2(
                                                         new NestedObject[] { new NestedObject("vic", 0), new NestedObject("yuan", 1000) },
                                                         new TestObject5(new NestedObject[] { new NestedObject("vic", 0), new NestedObject("yuan", 1000), new NestedObject("pepe", -30) })
                                                         ));

        TestObject6 obj = JsonParser.FromJson <TestObject6>(jsonString);

        if (expectedResult.Equals(obj))
        {
            Debug.Log("Reader Test 6 : Success");
        }
        else
        {
            Debug.LogWarning("Reader Test 6 : Failure");
        }

        string json = JsonParser.ToJson <TestObject6>(obj);

        if (jsonString == json)
        {
            Debug.Log("Writer Test 6 : Success");
        }
        else
        {
            Debug.LogWarning(String.Format("Writer Test 6 : Failure : {0}", json));
        }
    }
Example #2
0
 public bool Equals(TestObject6 other)
 {
     if (!this.nested.Equals(other.nested))
     {
         Debug.LogWarning("TestObject6 : Field nested does not match. Type NestedObject2");
         return(false);
     }
     return(true);
 }