Sending JSON response via GenericJsonWebHookReceiver MVC ASP.NET - json

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

Related

Sim808 + Arduino UNO: Get Json Object Response from Web Server

How to read JSON object response from the server?
These are the commands I use:
AT+SAPBR=3,1,"Contype","GPRS"
AT+SAPBR=3,1,"APN","internet"
AT+SAPBR=1,1
AT+SAPBR=2,1
AT+HTTPINIT
AT+HTTPSSL=1
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","https://www.mywebsite.com/getTime?token=jsdaljdaskl"
AT+HTTPPARA="REDIR",1
AT+HTTPACTION=0
The returning request should be Json object, but the Sim808 read it as html response which gives error 606.
Need to define HTTP parameter content as JSON format using the following command
AT+HTTPPARA="CONTENT","application/json"
Found this document useful HTTP Client using SIM900.

JMeter Groovy convert JSON response to string

I've been looking through various solutions for converting JSON responses to string, but I'm still getting something wrong.
I'm trying to read the response from a post request, convert it to a string and modify it (using groovy), then pass it on the next request. The problem seems to be in the groovy script, it's not reading in the response from the first HTTP request and I'm not sure how to fix that.

Axis2C : Sending data with Custom content type

The client (Browser) expects to receive a JSON string in response. I have the JSON string to send at the service side. However the calling function (axis2_invoke) expects axiom_node_t which make it return XML.
Is there a way to send my response in a way I want to and not as axiom objects
AxiOM is a data abstraction layer, not XML.
When talking about Axis2/C-unofficial which supports JSON natively, you will get response depending of your request format:
if you setup Content-Type of your request to application/json you will get response in JSON format;
if you setup Content-Type of your request to application/soap+xml you will get response in SOAP format.
Your response AxiOM is to be be converted to appropriate format by Axis2/C's transport sender.

Using Rest assured to validate saved JSON response

I have a question regarding REST Assured. - https://code.google.com/p/rest-assured/wiki/Usage
I understand that I can use REST assured to make HTTP calls(.get .put etc.) and validate the response using when() etc. I would like to validate JSON responses that I have already saved in the database, instead of Calling the web service realtime and validating it's response.
Can I use REST-assured to Load a JSON response as a String and validate it?
Yes you can use Rest Assured's JsonPath project independently of Rest Assured (see getting started page). Once you have it in classpath you can do something like this:
JsonPath jsonPath = new JsonPath(<your json as string>);
String title = jsonPath.getString("x.y.title");

json returned from flickr api not getting parsed

I am trying to consume flickr api and requesting data in json format from a node.js server. I am providing nojsoncallback=1 so that returned json is not wrapped inside a jsonp callback. Here is the url http://api.flickr.com/services/feeds/photos_public.gne?format=json&nojsoncallback=1.
Json returned is not properly formatted and JSON.parse is unable to parse it. If I don't pass nojsoncallback query param and eval the response which calls jsonFlickrFeed function, it gets evaled properly and I get the object. I also notice that the Content-type header in the response is application/x-javascript; charset=utf-8. I suspect that the special characters are double escaped in returned response.
I don't want to eval, what can I do to convert the response correctly into a string and then parse it?
By the way here is the gist with simplest use case. No modules, no middlewares.