web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Deserializing Json Data in C#

(0) ShareShare
ReportReport
Posted on by 233

Hello,

I am not able to deserialize the below json format ,for retrieving the data please any body suggest me 

{"creator_email":"thomas.v@almouj.com","vcard_info":"BEGIN:VCARD\r\nVERSION:2.1\r\nFN;CHARSET=utf-8:Hyder Hafir\r\nTEL;CELL;X-EDIT=0;X-POS=180,175,11,130;CHARSET=utf-8:+96891365444\r\nTEL;WORK;X-EDIT=0;X-POS=240,251,12,139;CHARSET=utf-8:+96824170123\r\nTEL;WORK;X-EDIT=0;X-POS=256,70,13,161;CHARSET=utf-8:2313504\r\nTEL;WORK;FAX;X-EDIT=0;X-POS=258,251,12,140;CHARSET=utf-8:+96824170038\r\nX-IS-TAKE-ADR;CHARSET=utf-8:0;0;\r\nN;X-EDIT=0;X-POS=142,248,15,79;CHARSET=utf-8:Hyder;Hafir ;;;\r\nEMAIL;WORK;X-EDIT=0;X-POS=275,251,15,169;CHARSET=utf-8:oman@telephonyme.com\r\nEXCHANGEDATE:2019-06-17\r\nEXCHANGEDATE:2019-06-17\r\nAUTHOR:IntSig-iOS-iPhone\r\nADR;WORK;X-EDIT=0;X-POS=273,70,30,161,0,0,0,0;CHARSET=utf-8:;;Knowledge Oasis Muscat Muscat, Sultanate Of;;;;Oman\r\nADR;WORK;X-EDIT=0;X-POS=239,70,13,160,0,0,0,0;CHARSET=utf-8:;;First Floor, Office# 0401 Z321;;;;\r\nORG;WORK;X-EDIT=0;X-POS=57,26,11,147,141,157,15,73,158,147,15,203;CHARSET=utf-8:p.p.j L:\/uLmululjqdtu;JJL LLM;Operation Manager I\\\\ilLml Aui\r\nURL;HOMEPAGE;X-EDIT=0;X-POS=293,251,14,150;CHARSET=utf-8:www.telephonyme.com\r\nEND:VCARD","front_jpg":"6X7705UC5b7Kfh8KyBQCC8EV_front.jpg","creator_name":"Thomas Varghese","upload_time":"1560756635574","create_time":"1560756633000"}

*This post is locked for comments

I have the same question (0)
  • necsa Profile Picture
    3,455 on at
  • necsa Profile Picture
    3,455 on at

    Hi Amrutha,

    instead of double quote use single quote in your json format.

  • Kishore P Profile Picture
    45 on at

    Hi

    Try These ,

    using (MemoryStream DeSerializememoryStream = new MemoryStream())
                    {
                        string ResponseString = "{"creator_email":"thomas.v@almouj.com","vcard_info":"BEGIN:VCARD\r\nVERSION:2.1\r\nFN;CHARSET=utf-8:Hyder Hafir\r\nTEL;CELL;X-EDIT=0;X-POS=180,175,11,130;CHARSET=utf-8:+96891365444\r\nTEL;WORK;X-EDIT=0;X-POS=240,251,12,139;CHARSET=utf-8:+96824170123\r\nTEL;WORK;X-EDIT=0;X-POS=256,70,13,161;CHARSET=utf-8:2313504\r\nTEL;WORK;FAX;X-EDIT=0;X-POS=258,251,12,140;CHARSET=utf-8:+96824170038\r\nX-IS-TAKE-ADR;CHARSET=utf-8:0;0;\r\nN;X-EDIT=0;X-POS=142,248,15,79;CHARSET=utf-8:Hyder;Hafir ;;;\r\nEMAIL;WORK;X-EDIT=0;X-POS=275,251,15,169;CHARSET=utf-8:oman@telephonyme.com\r\nEXCHANGEDATE:2019-06-17\r\nEXCHANGEDATE:2019-06-17\r\nAUTHOR:IntSig-iOS-iPhone\r\nADR;WORK;X-EDIT=0;X-POS=273,70,30,161,0,0,0,0;CHARSET=utf-8:;;Knowledge Oasis Muscat Muscat, Sultanate Of;;;;Oman\r\nADR;WORK;X-EDIT=0;X-POS=239,70,13,160,0,0,0,0;CHARSET=utf-8:;;First Floor, Office# 0401 Z321;;;;\r\nORG;WORK;X-EDIT=0;X-POS=57,26,11,147,141,157,15,73,158,147,15,203;CHARSET=utf-8:p.p.j L:\/uLmululjqdtu;JJL LLM;Operation Manager I\\\\ilLml Aui\r\nURL;HOMEPAGE;X-EDIT=0;X-POS=293,251,14,150;CHARSET=utf-8:www.telephonyme.com\r\nEND:VCARD","front_jpg":"6X7705UC5b7Kfh8KyBQCC8EV_front.jpg","creator_name":"Thomas Varghese","upload_time":"1560756635574","create_time":"1560756633000"}";
                        DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(jsonformate));
                        StreamWriter writer = new StreamWriter(DeSerializememoryStream);
                        writer.Write(ResponseString);
                        writer.Flush();
                        DeSerializememoryStream.Position = 0;
                        jsonformate SerializedObject = (jsonformate)serializer.ReadObject(DeSerializememoryStream);
                        var creator_email= SerializedObject.creator_email;
                        var vcard_info= SerializedObject.vcard_info;
                        var front_jpg= SerializedObject.front_jpg;
                        var creator_name= SerializedObject.creator_name;
                        var upload_time= SerializedObject.upload_time;
                        var create_time= SerializedObject.create_time;
                    }

    public class jsonformate
        {
            [DataMember]
            public string creator_email { get; set; }
            
            [DataMember]
            public string vcard_info { get; set; }

             [DataMember]
            public string front_jpg { get; set; }

             [DataMember]
            public string creator_name { get; set; }

             [DataMember]
            public string upload_time { get; set; }

             [DataMember]
            public string create_time { get; set; }
            
        }

  • Suggested answer
    Kalpavruksh D365 CoE Profile Picture
    2,545 on at

    Hi Amrutha,

    It depends on which node you want to extract. For example, in the following code, I wanted to extract "ID" subnode from "result" node

    var ContactDetails = new JavaScriptSerializer().Deserialize<Dictionary<string, object>>(jsonResponse.ToString());

    var sContactDetails = (Dictionary<string, object>)ContactDetails["result"]; sContactID = sContactDetails["id"].ToString();

    Please use the following link for more details:

    stackoverflow.com/.../deserialize-json-string-to-dictionarystring-object

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans