10

I can't get access to the DataContractJsonSerializer method from System.Runtime.Serialization.Json

If I do:

using System.Runtime.Serialization.Json;

I get an error...

How can I access this in my Asp.Net Mvc app so I can use the DataContractJsonSerializer method

Matt
  • 5,547
  • 23
  • 82
  • 121

2 Answers2

18

Make sure you've referenced the DLL where this type lives: System.ServiceModel.Web.dll

Brad Wilson
  • 67,914
  • 9
  • 74
  • 83
  • I did that and it still can't find it: http://screencast.com/t/IOEUsdN1E any other suggestion? – Carlo Nov 03 '11 at 09:27
  • 10
    @Carlo, "The MSDN docs for .NET 3.5 incorrectly state that DataContractJsonSerializer lives in System.Runtime.Serialization.dll. This is true in .NET 4, but in 3.5 it's found in System.ServiceModel.Web.dll." - Ref: Comment by LukeH - [URL](http://stackoverflow.com/questions/3178218/using-the-wcf-datacontractjsonserializer-in-net-3-5) – Anthony Walsh Dec 19 '11 at 16:09
  • Ah yeah I found this a few weeks ago! Thanks! =) – Carlo Dec 19 '11 at 19:00
0

Right Click in Project, Add Reference...

Search for System.Runtime.Serialization

Click Ok/Add