Skip to content

Commit

Permalink
Fixed Ourpalm#252
Browse files Browse the repository at this point in the history
  • Loading branch information
liiir1985 committed Apr 2, 2020
1 parent f6707c9 commit b8bdd82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions LitJson/JsonMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ private static object ReadValue (Type inst_type, JsonReader reader)
if (item == null && reader.Token == JsonToken.ArrayEnd)
break;
var rt = elem_type is ILRuntime.Reflection.ILRuntimeWrapperType ? ((ILRuntime.Reflection.ILRuntimeWrapperType)elem_type).RealType : elem_type;
rt = elem_type is ILRuntime.Reflection.ILRuntimeType ? ((ILRuntime.Reflection.ILRuntimeType)elem_type).ILType.TypeForCLR : elem_type;
item = rt.CheckCLRTypes(item);
list.Add (item);
}
Expand Down
4 changes: 4 additions & 0 deletions TestCases/JsonTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class JsonTestSubClass
{
public long LongProp { get; set; }
public List<JsonTestSubClass> SubClassList { get; set; }
public List<JsonTestEnum> SubClassEnumList { get; set; }
public JsonTestSubClass[] ArrayProp { get; set; }
}

Expand Down Expand Up @@ -78,6 +79,8 @@ public static void JsonTest1()
sub.SubClassList = new List<TestCases.JsonTest.JsonTestSubClass>();
sub.SubClassList.Add(sub2);
sub.SubClassList.Add(sub3);
sub.SubClassEnumList = new List<JsonTestEnum>();
sub.SubClassEnumList.Add(JsonTestEnum.Test2);

cls.DicTest = new Dictionary<string, TestCases.JsonTest.JsonTestSubClass>();
cls.DicTest["11111"] = sub;
Expand All @@ -92,6 +95,7 @@ public static void JsonTest1()
Console.WriteLine(cls2.SubClassProp.ArrayProp[1].LongProp);
Console.WriteLine(cls2.SubClassProp.SubClassList[0].LongProp);
Console.WriteLine(cls2.SubClassProp.SubClassList[1].LongProp);
Console.WriteLine(cls2.SubClassProp.SubClassEnumList[0]);
Console.WriteLine(cls2.DicTest["11111"].LongProp);
Console.WriteLine(cls2.DicTest2["111222"]);

Expand Down

0 comments on commit b8bdd82

Please sign in to comment.