Cannot parse Json String

sarala

New member
Joined
Aug 13, 2015
Messages
3
Programming Experience
5-10
Hi,

I have errors when deserializing the below Json String. can you please help

"{
""RightNowMessageId"": 1738,
""ApplicationReferenceNbr"": ""GU30301"",
""ApplicationTypeCode"": ""DIRECT_HDR"",
""ApplicationTypeDescr"": ""AdmissiontoaHigherDegreebyResearchprogram"",
""ApplicationCreatedDate"": ""2015-07-24"",
""ApplicationUpdatedDate"": ""2015-07-24"",
""ApplicationSubmittedDate"": null,
""ApplicationStatus"": ""Incomplete"",
""ApplicationURL"": ""https: //degrees-test.griffith.edu.au/online-admissions/Redirect/Index/30301"",
""ApplicantCRMAccountName"": ""u.guduru@griffith.edu.au"",
""ApplicantProvidedNameTitle"": null,
""ApplicantProvidedFirstName"": ""Umadevi"",
""ApplicantProvidedMiddleName"": null,
""ApplicantProvidedLastName"": ""Guduru"",
""ApplicantPreferredFirstName"": null,
""ApplicantPreferredEmail"": ""u.guduru@griffith.edu.au"",
""ApplicantPreferredPhoneNbr"": null,
""ADM_APPL_NBR"": null,
""Communication_APPL_PROG_NBR"": null,
""Preferences"": [

]
}"

code i used is--------------------->

JsonConvert.DeserializeObject(str);
 

JohnH

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
1,183
Location
Norway
Programming Experience
10+
I have errors when deserializing the below Json String. can you please help
That is not a Json string, it is C# code for an escaped verbatim string literal representing a Json string. In code you declare it like this:
var str = @"{
""RightNowMessageId"": 1738,
...et cetera...
}";

Read about strings in code here: string (C# Reference)

A Json string in for example a text file looks like this:
{
"RightNowMessageId": 1738,
...et cetera...
}
 

sarala

New member
Joined
Aug 13, 2015
Messages
3
Programming Experience
5-10
json error.png I have attached the error message
 

sarala

New member
Joined
Aug 13, 2015
Messages
3
Programming Experience
5-10
This string is retrieved from a CRM database. Is it possible to make it as a Json string.Can we remove those extra double quotes?
 

JohnH

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
1,183
Location
Norway
Programming Experience
10+
This string is retrieved from a CRM database. Is it possible to make it as a Json string.Can we remove those extra double quotes?
You have to "decode" it, the first and last " needs to go away, and all "" must be ". Simple string replacement operations.
 
Top Bottom