Skip to content

Commit 9d11af9

Browse files
committed
103 prerelease stuff
swapped jsonserialier and misc packaging
1 parent 2f73bd3 commit 9d11af9

File tree

9 files changed

+34
-53
lines changed

9 files changed

+34
-53
lines changed

RestSharp.Silverlight/RestSharp.Silverlight.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@
175175
<Compile Include="..\RestSharp\Serializers\ISerializer.cs">
176176
<Link>Serializers\ISerializer.cs</Link>
177177
</Compile>
178+
<Compile Include="..\RestSharp\Serializers\JsonSerializer.cs">
179+
<Link>Serializers\JsonSerializer.cs</Link>
180+
</Compile>
178181
<Compile Include="..\RestSharp\Serializers\SerializeAsAttribute.cs">
179182
<Link>Serializers\SerializeAsAttribute.cs</Link>
180183
</Compile>

RestSharp.WindowsPhone/RestSharp.WindowsPhone.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@
248248
<Compile Include="..\restsharp\serializers\ISerializer.cs">
249249
<Link>Serializers\ISerializer.cs</Link>
250250
</Compile>
251+
<Compile Include="..\RestSharp\Serializers\JsonSerializer.cs">
252+
<Link>Serializers\JsonSerializer.cs</Link>
253+
</Compile>
251254
<Compile Include="..\restsharp\serializers\SerializeAsAttribute.cs">
252255
<Link>Serializers\SerializeAsAttribute.cs</Link>
253256
</Compile>

RestSharp/RestRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public RestRequest()
4949
Parameters = new List<Parameter>();
5050
Files = new List<FileParameter>();
5151
XmlSerializer = new XmlSerializer();
52-
//JsonSerializer = new JsonSerializer();
52+
JsonSerializer = new JsonSerializer();
5353

5454
OnBeforeDeserialization = r => { };
5555
}

RestSharp/RestSharp.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
<Compile Include="Deserializers\DotNetXmlDeserializer.cs" />
140140
<Compile Include="Serializers\DotNetXmlSerializer.cs" />
141141
<Compile Include="Serializers\ISerializer.cs" />
142+
<Compile Include="Serializers\JsonSerializer.cs" />
142143
<Compile Include="Serializers\SerializeAsAttribute.cs" />
143144
<Compile Include="Serializers\XmlSerializer.cs" />
144145
<Compile Include="Http.Async.cs" />

RestSharp/Serializers/JsonSerializer.cs

Lines changed: 7 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,4 @@
1-
#region License
2-
// Copyright 2010 John Sheehan
3-
//
4-
// Licensed under the Apache License, Version 2.0 (the "License");
5-
// you may not use this file except in compliance with the License.
6-
// You may obtain a copy of the License at
7-
//
8-
// http://www.apache.org/licenses/LICENSE-2.0
9-
//
10-
// Unless required by applicable law or agreed to in writing, software
11-
// distributed under the License is distributed on an "AS IS" BASIS,
12-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
// See the License for the specific language governing permissions and
14-
// limitations under the License.
15-
#endregion
16-
#region Acknowledgements
17-
// Original JsonSerializer contributed by Daniel Crenna (@dimebrain)
18-
#endregion
19-
20-
using System.IO;
21-
using Newtonsoft.Json;
1+
using System.IO;
222

233
namespace RestSharp.Serializers
244
{
@@ -28,45 +8,22 @@ namespace RestSharp.Serializers
288
/// </summary>
299
public class JsonSerializer : ISerializer
3010
{
31-
private readonly Newtonsoft.Json.JsonSerializer _serializer;
32-
33-
/// <summary>
11+
/// <summary>
3412
/// Default serializer
3513
/// </summary>
36-
public JsonSerializer() {
14+
public JsonSerializer()
15+
{
3716
ContentType = "application/json";
38-
_serializer = new Newtonsoft.Json.JsonSerializer {
39-
MissingMemberHandling = MissingMemberHandling.Ignore,
40-
NullValueHandling = NullValueHandling.Include,
41-
DefaultValueHandling = DefaultValueHandling.Include
42-
};
4317
}
4418

45-
/// <summary>
46-
/// Default serializer with overload for allowing custom Json.NET settings
47-
/// </summary>
48-
public JsonSerializer(Newtonsoft.Json.JsonSerializer serializer){
49-
ContentType = "application/json";
50-
_serializer = serializer;
51-
}
52-
5319
/// <summary>
5420
/// Serialize the object as JSON
5521
/// </summary>
5622
/// <param name="obj">Object to serialize</param>
5723
/// <returns>JSON as String</returns>
58-
public string Serialize(object obj) {
59-
using (var stringWriter = new StringWriter()) {
60-
using (var jsonTextWriter = new JsonTextWriter(stringWriter)) {
61-
jsonTextWriter.Formatting = Formatting.Indented;
62-
jsonTextWriter.QuoteChar = '"';
63-
64-
_serializer.Serialize(jsonTextWriter, obj);
65-
66-
var result = stringWriter.ToString();
67-
return result;
68-
}
69-
}
24+
public string Serialize(object obj)
25+
{
26+
return SimpleJson.SerializeObject(obj);
7027
}
7128

7229
/// <summary>

Tools/NuGet.exe

32 KB
Binary file not shown.

package.cmd

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if not exist Download\Silverlight mkdir Download\Silverlight
1+
if not exist Download\Silverlight mkdir Download\Silverlight
22
if not exist Download\WindowsPhone\7.0\ mkdir Download\WindowsPhone\7.0\
33
if not exist Download\WindowsPhone\7.1\ mkdir Download\WindowsPhone\7.1\
44
if not exist Download\package\lib\net35 mkdir Download\package\lib\net35
@@ -19,6 +19,8 @@ copy RestSharp.WindowsPhone.Mango\bin\Release\*.dll Download\WindowsPhone\7.1\
1919
copy RestSharp.WindowsPhone.Mango\bin\Release\*.xml Download\WindowsPhone\7.1\
2020

2121
copy LICENSE.txt Download
22+
copy readme.txt Download
23+
copy readme.txt Download\package
2224

2325
copy RestSharp\bin\Release\RestSharp.dll Download\Package\lib\net35\
2426
copy RestSharp\bin\Release\RestSharp.dll Download\Package\lib\net35-client\
@@ -32,4 +34,5 @@ copy RestSharp.Silverlight\bin\Release\RestSharp.Silverlight.xml Download\Packag
3234
copy RestSharp.WindowsPhone\bin\Release\RestSharp.WindowsPhone.xml Download\Package\lib\sl3-wp\
3335
copy RestSharp.WindowsPhone.Mango\bin\Release\RestSharp.WindowsPhone.xml Download\Package\lib\sl4-wp71\
3436

37+
tools\nuget.exe update -self
3538
tools\nuget.exe pack restsharp.nuspec -BasePath Download\Package -Output Download

readme.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
*** IMPORTANT CHANGE IN VERSION 103 ***
2+
3+
In 103.0, JSON.NET was removed as a dependency.
4+
5+
If this is still installed in your project and no other libraries depend on it you may remove it from your installed packages.
6+
7+
There is one breaking change: the default JsonSerializer is no longer compatible with Json.NET. To use Json.NET for serialization, copy the code from https://github.com/restsharp/RestSharp/blob/86b31f9adf049d7fb821de8279154f41a17b36f7/RestSharp/Serializers/JsonSerializer.cs and register it with your client:
8+
9+
var client = new RestClient();
10+
client.JsonSerializer = new YourCustomSerializer();
11+
12+
If you run into any compatibility issues with deserialization, please report it to http://groups.google.com/group/restsharp

restsharp.nuspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package>
33
<metadata>
44
<id>RestSharp</id>
5-
<version>102.7</version>
5+
<version>103.0.0-nojsondotnet</version>
66
<authors>John Sheehan, RestSharp Community</authors>
77
<owners>John Sheehan</owners>
88
<description>Simple REST and HTTP API Client</description>
@@ -12,6 +12,8 @@
1212
<iconUrl>http://dl.dropbox.com/u/1827/restsharp100.png</iconUrl>
1313
<tags>REST HTTP API JSON XML</tags>
1414
<releaseNotes>
15+
103.0 - Remove dependency on Json.NET
16+
Remove WP7.0 support (7.1 Mango remains).
1517
102.7 - Updating Json.NET to 4.0.8, misc fixes
1618
102.6 - Updating Json.NET reference to 4.0.5
1719
</releaseNotes>

0 commit comments

Comments
 (0)