Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Data serialization

(0) ShareShare
ReportReport
Posted on by 110

Hi,

I want to serialize few data. I tried javascriptSerializer for console application. Im trying to implement the same using plugins but javascriptSerializer is not getting accepted. Is there any other option where i can serialize my content?

*This post is locked for comments

  • Suggested answer
  • Suggested answer
    ashlega Profile Picture
    ashlega 34,477 on at
    RE: Data serialization

    Hi,

     here is what works for me in the plugins:

              using System.Runtime.Serialization.Json;

            ...

    public string JSONSerialize() { DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(SerializationData)); MemoryStream ms = new MemoryStream(); ser.WriteObject(ms, this); string jsonString = Encoding.UTF8.GetString(ms.ToArray()); ms.Close(); return jsonString; } public static SerializationData CreateFromJsonStream(Stream stream) { DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(SerializationData)); SerializationData data; data = (SerializationData)serializer.ReadObject(stream); return data; } public static SerializationData CreateFromJsonString(string json) { SerializationData data; using (MemoryStream stream = new MemoryStream(System.Text.Encoding.Default.GetBytes(json))) { data = CreateFromJsonStream(stream); } return data; }
  • PranavShroti Profile Picture
    PranavShroti 4,510 on at
    RE: Data serialization

    Dear Sathish, kindly explain bit more what exactly you are trying to do, what kind of data etc.

    Regards,

    Pranav

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,321 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans