Skip to content

Commit e4ccaa0

Browse files
committed
Workaround for buggy Mono SerializationInfo.GetString
1 parent c8ca517 commit e4ccaa0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Newtonsoft.Json/Serialization/JsonFormatterConverter.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,14 @@ private T GetTokenValue<T>(object value)
5454
{
5555
ValidationUtils.ArgumentNotNull(value, nameof(value));
5656

57+
#if UNITY3D
58+
if (value is JValue)
59+
value = ((JValue)value).Value;
60+
return (T)System.Convert.ChangeType(value, typeof(T), CultureInfo.InvariantCulture);
61+
#else
5762
JValue v = (JValue)value;
5863
return (T)System.Convert.ChangeType(v.Value, typeof(T), CultureInfo.InvariantCulture);
64+
#endif
5965
}
6066

6167
public object Convert(object value, Type type)

0 commit comments

Comments
 (0)