diff --git a/NetJSON.Core.Tests/Properties/AssemblyInfo.cs b/NetJSON.Core.Tests/Properties/AssemblyInfo.cs index a719d51..96ff443 100644 --- a/NetJSON.Core.Tests/Properties/AssemblyInfo.cs +++ b/NetJSON.Core.Tests/Properties/AssemblyInfo.cs @@ -6,7 +6,7 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Hewlett-Packard")] +[assembly: AssemblyCompany("Phoenix Service Bus")] [assembly: AssemblyProduct("NetJSON.Core.Tests")] [assembly: AssemblyTrademark("")] diff --git a/NetJSON.Core/Properties/AssemblyInfo.cs b/NetJSON.Core/Properties/AssemblyInfo.cs index 67621a1..adc56aa 100644 --- a/NetJSON.Core/Properties/AssemblyInfo.cs +++ b/NetJSON.Core/Properties/AssemblyInfo.cs @@ -24,6 +24,6 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.3")] -[assembly: AssemblyFileVersion("1.2.3")] +[assembly: AssemblyVersion("1.2.4")] +[assembly: AssemblyFileVersion("1.2.4")] [assembly: InternalsVisibleTo(NetJSON.NetJSON.NET_JSON_GENERATED_ASSEMBLY_NAME)] \ No newline at end of file diff --git a/NetJSON.Tests/Properties/AssemblyInfo.cs b/NetJSON.Tests/Properties/AssemblyInfo.cs index 283977c..813dc45 100644 --- a/NetJSON.Tests/Properties/AssemblyInfo.cs +++ b/NetJSON.Tests/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.3")] -[assembly: AssemblyFileVersion("1.2.3")] +[assembly: AssemblyVersion("1.2.4")] +[assembly: AssemblyFileVersion("1.2.4")] diff --git a/NetJSON.Tests/SerializeTests.cs b/NetJSON.Tests/SerializeTests.cs index 8c3639f..72ad1c3 100644 --- a/NetJSON.Tests/SerializeTests.cs +++ b/NetJSON.Tests/SerializeTests.cs @@ -1256,6 +1256,29 @@ public void CanDeserializeLargeNumbers() Assert.AreEqual(test["test"], 9999999999); } + [TestMethod] + public void CanDeserializeKeyAndValueProperly() + { + var xy = new A(); + xy.Details.Add(666, null); + + var json = NetJSON.Serialize(xy); + var obj = NetJSON.Deserialize(json); + + Assert.IsTrue(xy.Details.ContainsKey(666)); + } + + [TestMethod] + public void CanDeserilizeDictionaryKeyAndValue() + { + var dict = new Dictionary(); + dict.Add(666, new B()); + var json = NetJSON.Serialize(dict); + var obj = NetJSON.Deserialize>(json); + + Assert.IsTrue(obj.ContainsKey(666)); + } + private static bool CanSerialize(MemberInfo memberInfo) { var attr = memberInfo.GetCustomAttribute(); @@ -1268,6 +1291,20 @@ private static bool CanSerialize(MemberInfo memberInfo) } } + public class A + { + public A() + { + Details = new Dictionary(); + } + + public Dictionary Details { get; set; } + } + + public class B + { + } + struct SimpleObjectStruct { public int ID; diff --git a/NetJSON.V3_5.Tests/Properties/AssemblyInfo.cs b/NetJSON.V3_5.Tests/Properties/AssemblyInfo.cs index d248ee7..ea10ace 100644 --- a/NetJSON.V3_5.Tests/Properties/AssemblyInfo.cs +++ b/NetJSON.V3_5.Tests/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.3")] -[assembly: AssemblyFileVersion("1.2.3")] +[assembly: AssemblyVersion("1.2.4")] +[assembly: AssemblyFileVersion("1.2.4")] diff --git a/NetJSON/NetJSON.cs b/NetJSON/NetJSON.cs index 6c48273..1c6948e 100644 --- a/NetJSON/NetJSON.cs +++ b/NetJSON/NetJSON.cs @@ -5206,15 +5206,6 @@ private static void GenerateGetClassOrDictStringType(TypeBuilder typeBuilder, Ty IncrementIndexRef(il); if (isDict) { - - - var isStringBasedLabel1 = il.DefineLabel(); - var isStringBasedLabel2 = il.DefineLabel(); - - il.Emit(OpCodes.Ldloc, isStringBasedLocal); - il.Emit(OpCodes.Brfalse, isStringBasedLabel1); - -#region true il.Emit(OpCodes.Ldloc, obj); if (isExpandoObject) il.Emit(OpCodes.Isinst, _idictStringObject); @@ -5229,32 +5220,6 @@ private static void GenerateGetClassOrDictStringType(TypeBuilder typeBuilder, Ty il.Emit(OpCodes.Newobj, _genericKeyValuePairType.MakeGenericType(keyType, valueType).GetConstructor(new[] { keyType, valueType })); } il.Emit(OpCodes.Callvirt, dictSetItem); -#endregion - - il.MarkLabel(isStringBasedLabel1); - - - il.Emit(OpCodes.Ldloc, isStringBasedLocal); - il.Emit(OpCodes.Brtrue, isStringBasedLabel2); - -#region false - il.Emit(OpCodes.Ldloc, obj); - if (isExpandoObject) - il.Emit(OpCodes.Isinst, _idictStringObject); - - il.Emit(OpCodes.Ldloc, keyLocal); - - il.Emit(OpCodes.Ldarg_0); - il.Emit(OpCodes.Ldarg_1); - il.Emit(OpCodes.Ldarg_2); - il.Emit(OpCodes.Call, GenerateExtractValueFor(typeBuilder, valueType)); - if (isKeyValuePair && !isExpandoObject) { - il.Emit(OpCodes.Newobj, _genericKeyValuePairType.MakeGenericType(keyType, valueType).GetConstructor(new[] { keyType, valueType })); - } - il.Emit(OpCodes.Callvirt, dictSetItem); -#endregion - - il.MarkLabel(isStringBasedLabel2); } else { if (!isTuple) { //Set property based on key diff --git a/NetJSON/NetJSON.nuspec b/NetJSON/NetJSON.nuspec index 1f673a0..b6c52db 100644 --- a/NetJSON/NetJSON.nuspec +++ b/NetJSON/NetJSON.nuspec @@ -4,11 +4,11 @@ NetJSON NetJSON json json-serializer javascript JSON serializer binary - 1.2.3 + 1.2.4 TJ Bakre Faster than Any Binary? - Fixed issue with Deserializing large integer in object type + Fixed issue with not deserializing dictionary that uses integer as key properly en-US https://github.com/rpgmaker/NetJSON/blob/master/LICENSE.text diff --git a/NetJSON/Properties/AssemblyInfo.cs b/NetJSON/Properties/AssemblyInfo.cs index a693e2c..5d68df6 100644 --- a/NetJSON/Properties/AssemblyInfo.cs +++ b/NetJSON/Properties/AssemblyInfo.cs @@ -33,8 +33,8 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.3")] -[assembly: AssemblyFileVersion("1.2.3")] +[assembly: AssemblyVersion("1.2.4")] +[assembly: AssemblyFileVersion("1.2.4")] #if !NET_35 [assembly: SecurityRules(SecurityRuleSet.Level2, SkipVerificationInFullTrust = true)] #endif diff --git a/NetJSON/lib/net35/NetJSON.dll b/NetJSON/lib/net35/NetJSON.dll index 513bf51..d7437ac 100644 Binary files a/NetJSON/lib/net35/NetJSON.dll and b/NetJSON/lib/net35/NetJSON.dll differ diff --git a/NetJSON/lib/net40/NetJSON.dll b/NetJSON/lib/net40/NetJSON.dll index 1018657..4158050 100644 Binary files a/NetJSON/lib/net40/NetJSON.dll and b/NetJSON/lib/net40/NetJSON.dll differ diff --git a/NetJSON/lib/netstandard1.6/NetJSON.Core.dll b/NetJSON/lib/netstandard1.6/NetJSON.Core.dll index a158df5..320e900 100644 Binary files a/NetJSON/lib/netstandard1.6/NetJSON.Core.dll and b/NetJSON/lib/netstandard1.6/NetJSON.Core.dll differ