Skip to content

Commit 14c0e61

Browse files
committed
Merge pull request restsharp#409 from restsharp/update-simplejson
Upgrade SimpleJson to 0.26.0
2 parents 315c01f + 61d16dc commit 14c0e61

File tree

4 files changed

+14
-18
lines changed

4 files changed

+14
-18
lines changed

RestSharp.Tests/SimpleJson.cs

+6-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// <website>https://github.com/facebook-csharp-sdk/simple-json</website>
1818
//-----------------------------------------------------------------------
1919

20-
// VERSION: 0.25.0
20+
// VERSION: 0.26.0
2121

2222
// NOTE: uncomment the following line to make SimpleJson class internal.
2323
//#define SIMPLE_JSON_INTERNAL
@@ -39,6 +39,8 @@
3939
// usually already defined in properties
4040
//#define NETFX_CORE;
4141

42+
// If you are targetting WinStore, WP8 and NET4.5+ PCL make sure to #define SIMPLE_JSON_TYPEINFO;
43+
4244
// original json parsing code from http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
4345

4446
#if NETFX_CORE
@@ -1330,13 +1332,9 @@ public virtual object DeserializeObject(object value, Type type)
13301332
return value;
13311333
if ((valueIsDouble && type != typeof(double)) || (valueIsLong && type != typeof(long)))
13321334
{
1333-
obj =
1334-
#if NETFX_CORE
1335-
type == typeof(int) || type == typeof(long) || type == typeof(double) || type == typeof(float) || type == typeof(bool) || type == typeof(decimal) || type == typeof(byte) || type == typeof(short)
1336-
#else
1337-
typeof(IConvertible).IsAssignableFrom(type)
1338-
#endif
1339-
? Convert.ChangeType(value, type, CultureInfo.InvariantCulture) : value;
1335+
obj = type == typeof(int) || type == typeof(long) || type == typeof(double) || type == typeof(float) || type == typeof(bool) || type == typeof(decimal) || type == typeof(byte) || type == typeof(short)
1336+
? Convert.ChangeType(value, type, CultureInfo.InvariantCulture)
1337+
: value;
13401338
}
13411339
else
13421340
{

RestSharp.Tests/packages.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Newtonsoft.Json" version="4.5.5" />
4-
<package id="SimpleJson" version="0.25.0" targetFramework="net40" />
4+
<package id="SimpleJson" version="0.26.0" targetFramework="net35" />
55
<package id="xunit" version="1.9.0.1566" />
66
<package id="xunit.extensions" version="1.9.0.1566" />
77
</packages>

RestSharp/SimpleJson.cs

+6-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// <website>https://github.com/facebook-csharp-sdk/simple-json</website>
1818
//-----------------------------------------------------------------------
1919

20-
// VERSION: 0.25.0
20+
// VERSION: 0.26.0
2121

2222
// NOTE: uncomment the following line to make SimpleJson class internal.
2323
//#define SIMPLE_JSON_INTERNAL
@@ -39,6 +39,8 @@
3939
// usually already defined in properties
4040
//#define NETFX_CORE;
4141

42+
// If you are targetting WinStore, WP8 and NET4.5+ PCL make sure to #define SIMPLE_JSON_TYPEINFO;
43+
4244
// original json parsing code from http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
4345

4446
#if NETFX_CORE
@@ -1330,13 +1332,9 @@ public virtual object DeserializeObject(object value, Type type)
13301332
return value;
13311333
if ((valueIsDouble && type != typeof(double)) || (valueIsLong && type != typeof(long)))
13321334
{
1333-
obj =
1334-
#if NETFX_CORE
1335-
type == typeof(int) || type == typeof(long) || type == typeof(double) || type == typeof(float) || type == typeof(bool) || type == typeof(decimal) || type == typeof(byte) || type == typeof(short)
1336-
#else
1337-
typeof(IConvertible).IsAssignableFrom(type)
1338-
#endif
1339-
? Convert.ChangeType(value, type, CultureInfo.InvariantCulture) : value;
1335+
obj = type == typeof(int) || type == typeof(long) || type == typeof(double) || type == typeof(float) || type == typeof(bool) || type == typeof(decimal) || type == typeof(byte) || type == typeof(short)
1336+
? Convert.ChangeType(value, type, CultureInfo.InvariantCulture)
1337+
: value;
13401338
}
13411339
else
13421340
{

RestSharp/packages.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="SimpleJson" version="0.25.0" targetFramework="net35-Client" />
3+
<package id="SimpleJson" version="0.26.0" targetFramework="net35" />
44
</packages>

0 commit comments

Comments
 (0)