Newtonsoft json parsing error - json

Until now i was using c# Newtonsoft json to parse graph api json responses. Everything was ok except when the text in the json response includes emoticons.
In that situation the json is not valid and the parsing stops.
is there any way to parse json with emoticons? do i have to convert them to something?

Related

Reading property from JSON object in Javascript with colons

I have a JSON object which I can console log out fine. However whenever I try to read the properties of this object I am getting "Unexpected token :" error. The json object does have a colon in it. How do i escape that colon and console.log the individual properties of the object. See that attached image for info
I think you can try out JSON serializer to get the JSON value. You can't get the JSON value without serializing it. So To serialize, you can use JsonConvert.SerializeObject("Json"). Check it out this link below for JSON serialization.
https://www.newtonsoft.com/json/help/html/SerializingJSON.htm
For serializing the JSON you should install Newtonsoft JSON package in your visual studio.

Sonar Issues/search API JSON result has single quotes

I'm using the sonarQube 6.4 web api to get a list of issues
http://sonar-server:9000/api/issues/search?componentKeys=Project_key&sinceLeakPeriod=true&statuses=OPEN,REOPENED&types=BUG
This gives me a Json object which has single quotes,
..."message":"Make this function anonymous by removing its name:
'function() {...}'."...
Because of that highlighted content in the JSON I'm unable to process the JSON from Groovy.
Is the JSON returned by the sonar is valid ?
if so, is there any way to process this kind of JSON in groovy.
Let me know if the full JSON object is needed.
According to http://json.org/ and https://jsonformatter.curiousconcept.com/ the JSON response is valid. Single quotes and brackets {} must not be escaped. The issue comes from your Groovy parser.

Sending JSON response via GenericJsonWebHookReceiver MVC ASP.NET

I need to send the JSON response from GenericJsonWebHookReceiver provided by Nuget package in ASP.NET.
I am trying to send the JSON value in the return call like this - "return Task.FromResult(sampleJson);"  , where sampleJson is a valid JSON in string format.
But while testing, I am still getting empty response.
How can we send the JSON response with GenericJsonWebHookReceiver? Also how to set the proper header type in the response to define it as JSON type response?
Thanks,
/vikas

Why do I get numeric characters in my raw JSON response from WCF?

Switching from XML to JSON on the fly in a WCF RESTful service. When I POST some JSON to the service from Fiddler, I get the right JSON back, but if you look in the RAW response, you get the JSON message that is sandwiched in between 2 numbers, like this:
Is this problematic for parsing the JSON? Like I said, the actual JSON looks fine.

how to identify json object or json array from a json parsing text?

i hav one problem , i parsed xml using json parsing and get json text. now i have to get values from xml. from that json text how i can identify jsonObject, jsonArray etc...
If you're doing this with JavaScript in a browser, try parsing the XML using jQuery.