Newton.JSON convert dynamic object to JObject instead of dynamic object

string  result ="{"AppointmentID":463236,"Message":"Successfully Appointment Booked","Success":true,"MessageCode":200,"isError":false,"Exception":null,"ReturnedValue":null}"

   dynamic d = JsonConvert.DeserializeObject<dynamic>(result);

d.GetType () is Newtonsoft.Json.Linq.JObject

so how to deserialize it to dynamic object instead of JObject

Answers


It's not quite clear what is not working for you and why you care about the return type but you could directly access the properties of the deserialized object like this:

string result = @"{""AppointmentID"":463236,""Message"":""Successfully Appointment Booked"",""Success"":true,""MessageCode"":200,""isError"":false,""Exception"":null,""ReturnedValue"":null}";
dynamic d = JsonConvert.DeserializeObject<dynamic>(result);

string message = d.Message;
int code = d.MessageCode;
...

Need Your Help

'Like' functionality in FQL / Graph API / iOS SDK

iphone ios facebook facebook-like

Does anyone know the recommended way of creating a FaceBook 'likes' button using the iOS Facebook SDK and the Graph API or FQL.

Pretty printing XML files on Emacs

xml emacs editor

I use emacs to edit my xml files (nxml-mode) and the files were generated by machine don't have any pretty formatting of the tags.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.