diff options
| author | Michael <[email protected]> | 2017-04-07 16:36:44 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-04-07 16:36:44 -0400 |
| commit | 1de8bc4bd0af72646ed58ecd7619a8731c48b09d (patch) | |
| tree | e9ae8f7b372d63ee6b40b4b7115eeb33f999d26a | |
| parent | 556fe967ae3f91f6c617e9fb0f317178c66a5053 (diff) | |
| download | project-unite-1de8bc4bd0af72646ed58ecd7619a8731c48b09d.tar.gz project-unite-1de8bc4bd0af72646ed58ecd7619a8731c48b09d.tar.bz2 project-unite-1de8bc4bd0af72646ed58ecd7619a8731c48b09d.zip | |
use .net serializer rather than json.net
| -rw-r--r-- | Project-Unite/Controllers/APIController.cs | 17 | ||||
| -rw-r--r-- | Project-Unite/Project-Unite.csproj | 6 |
2 files changed, 17 insertions, 6 deletions
diff --git a/Project-Unite/Controllers/APIController.cs b/Project-Unite/Controllers/APIController.cs index 1a71209..286b4f4 100644 --- a/Project-Unite/Controllers/APIController.cs +++ b/Project-Unite/Controllers/APIController.cs @@ -3,13 +3,24 @@ using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; -using Newtonsoft.Json; +using System.Web.Script.Serialization; using Project_Unite.Models; namespace Project_Unite.Controllers { public class APIController : Controller { + public JavaScriptSerializer Serializer + { + get; set; + } + //I'll put those curly braces on their own line just to piss a certain smiley off. + + public APIController() + { + Serializer = new JavaScriptSerializer(); + } + // GET: API public ActionResult Index() { @@ -26,13 +37,13 @@ namespace Project_Unite.Controllers if (!showObsolete) releases = releases.Where(x => x.Obsolete == false).ToArray(); - return Content(JsonConvert.SerializeObject(releases)); + return Content(Serializer.Serialize(releases)); } public ActionResult Skins() { var db = new ApplicationDbContext(); - return Content(JsonConvert.SerializeObject(db.Skins.ToArray())); + return Content(Serializer.Serialize(db.Skins.ToArray())); } } }
\ No newline at end of file diff --git a/Project-Unite/Project-Unite.csproj b/Project-Unite/Project-Unite.csproj index 36b45b0..5f09e0c 100644 --- a/Project-Unite/Project-Unite.csproj +++ b/Project-Unite/Project-Unite.csproj @@ -106,9 +106,9 @@ <Private>True</Private> </Reference> <Reference Include="Microsoft.CSharp" /> - <Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>Bin\Newtonsoft.Json.dll</HintPath> + <Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> + <HintPath>..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll</HintPath> + <Private>True</Private> </Reference> <Reference Include="Nito.AsyncEx, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\packages\Nito.AsyncEx.3.0.1\lib\net45\Nito.AsyncEx.dll</HintPath> |
