Here is a sample code snippet to return a JSON response from an HTTP server in C#:
main.cs1142 chars36 linesIn this example, we are using HttpListener to listen for incoming HTTP requests. When a GET request is received, we serialize a simple message using JsonConvert.SerializeObject and write it to the response stream as a JSON string. Finally, we set the content type to application/json and send the response back to the client.
gistlibby LogSnag