tag:blogger.com,1999:blog-2792201692341009334.post2019192013754794791..comments2023-03-25T11:06:10.374+00:00Comments on Sharpdev Blog: Deserialize JSON with C#Ricardo Rodrigueshttp://www.blogger.com/profile/07328669019913577877noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-2792201692341009334.post-44063708823195067452011-12-23T19:26:12.845+00:002011-12-23T19:26:12.845+00:00What if you have a mix? Like single, then array, t...What if you have a mix? Like single, then array, then single? And sometimes you have some singles, other times you don't?<br /><br />Like this:<br />{<br /> "id": "110770asd445977",<br /> "displayName": "Some Name",<br /> "gender": "male",<br /> "aboutMe": "That nice person",<br /> "image": {<br /> "url": "https://whatever.org/photo.jpg?sz=50"<br /> },<br /> "organizations": [<br /> {<br /> "name": "First org",<br /> "title": "Some title",<br /> "type": "school"<br /> },<br /> {<br /> "name": "Second org",<br /> "title": "Some other title",<br /> "type": "work"<br /> },<br /> ]<br />}<br /><br />And sometimes you will have gender, other times you won't. Sometimes you will have image, other times you won't.<br /><br />Does anyone know how to solve this without making 200 if's? If I put this into JSON.net, I guess I will struggle with errors when an x user has no organization.DusanVrbanhttps://www.blogger.com/profile/11581516144329317913noreply@blogger.comtag:blogger.com,1999:blog-2792201692341009334.post-11897698174148500422011-07-04T07:49:15.994+01:002011-07-04T07:49:15.994+01:00Hi
Is there any way to achieve the same without us...Hi<br />Is there any way to achieve the same without using Newtonsoft.....dll from wpf. I want to deserialise json object that contains details of 3 studentsjibinhttps://www.blogger.com/profile/09121424418898855997noreply@blogger.comtag:blogger.com,1999:blog-2792201692341009334.post-24973125180080041592010-02-01T17:37:08.773+00:002010-02-01T17:37:08.773+00:00This comment has been removed by the author.Navhttps://www.blogger.com/profile/04946119592961272618noreply@blogger.comtag:blogger.com,1999:blog-2792201692341009334.post-2717907099645698392010-01-20T15:25:01.961+00:002010-01-20T15:25:01.961+00:00Nice and Sweet :D
It's a nice and simple featu...Nice and Sweet :D<br />It's a nice and simple feature :D.<br />This DLL don't exist for .NET 1.1.<br />I used this static method [ Dim myDeserializedObj As String = Newtonsoft.Json.JsonConvert.SerializeObject(MyList)<br /><br /> Response.Write(myDeserializedObj)]<br /><br />And Just Work Fine!<br />Thanks Bro :DJoão Pachecohttps://www.blogger.com/profile/13175545547520905673noreply@blogger.comtag:blogger.com,1999:blog-2792201692341009334.post-59192333425972979002009-10-30T15:00:12.398+00:002009-10-30T15:00:12.398+00:00Thanks for the feedback :)
Just updated the post t...Thanks for the feedback :)<br />Just updated the post to reflect the API changes, thanks!Ricardo Rodrigueshttps://www.blogger.com/profile/07328669019913577877noreply@blogger.comtag:blogger.com,1999:blog-2792201692341009334.post-22258331455764320322009-10-30T11:11:54.180+00:002009-10-30T11:11:54.180+00:00Nice, worked very well!
Note: the API has changed...Nice, worked very well!<br /><br />Note: the API has changed, now it's Newtonsoft.Json.JsonConvert.DeserializeObject<T>(jsonString);Adrihttps://www.blogger.com/profile/05854830335318828203noreply@blogger.com