This question already has answers here:
How to post JSON with HttpClient using C#?
(2 answers)
How to post JSON to a server using C#?
(15 answers)
Closed 3 years ago.
I have a web client working against a Node.js app.
Now I need to update and integrate an existing C# into this scenario.
My C# generates a JSON object and I need to consume it in the Node.js app.
What's the simplest way do achieve this?
You can do it in many options, and you have a lot of examples in stackoverflow and in google.
Like #Alex said, you can do it via REST API, protocol like RTP, web sockets (for me this is the easiest way).
You have a lot of examples and module's like for example:
Mikeal's request
npmjs request
...
Examples:
here
and here
Related
This question already has answers here:
How can I deserialize JSON with C#?
(19 answers)
Closed 5 years ago.
I'm newbie in C# and I have no idea how to consume a JSON from an API. I would like to get this JSON: https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch=java&origin=*
And transform it in an C# Object. How Can I make that? Anyone has a very simple example? Also, I would like to understand the code.
I'm using Visual Studio 2015 and I want to make a Universal App.
Sorry for the very simple question.
Thanks! =D
you can use json.NET to get an json object. And the use
string serializedjson = JsonConvert.SerializeObject(obj); to create an serialized string.
This question already has answers here:
Output log using FtpWebRequest
(2 answers)
Closed 3 years ago.
Is there a way to override web Request or any other thing to log request/response for every web request(FTP or SFTP) we make.
I want to log it in DB thats why I want to override somehow.
Please note: I am asking solution for asp.net Core only.
Consider using RestSharp for .net core and log the response.Content which contains the raw response received on the wire, and then you could do like suggested here to get the request body before sending it:
request.Parameters.Where(p => p.Type == ParameterType.RequestBody).FirstOrDefault();
This question already has answers here:
Replace WCF default JSON serialization
(2 answers)
Closed 6 years ago.
I'm building a WCF service that also has an endpoint for JSON.
The problem is the DataContractSerializer default in WCF uses a standard I don't want to use. I looked into changing this, but I found no good way to do it. All threads and solutions I find for this are pretty old, 2012-2013. Is there a clean solution for this or have Microsoft made some changes to WCF to make this easier than writing your own DispatchMessageFormatter, etc.?
Note I'm not talking about the Web. This is a pure self-hosted WCF service.
I tried already implementing a DispatchMessageFormatter. It works, but it has some issues coming along with it, for example, all WebContentFormat has to be Raw, etc.
This question specifically mentions the accepted answers in that question and asking for another way to do this now five years later without all of the negative side effects it brings.
Try to intercept the message in the MessageInspector class (derives from IClientMessageInspector or IDispatchMessageInspector for the client and service respectively). Then convert XML to JSON and send as response.
I have not tried it; it is just a wild guess.
This question already has an answer here:
It is possible to read .Rdata file format from C or Fortran?
(1 answer)
Closed 6 years ago.
I have requirement to read data from ".RData" files and process them in C# application. I could not find any API which I can use in C#, I believe there is an API for F# which I don't use as of now because of learning curve in F#.
Could anybody please suggest code or API to read ".Rdata" files?
There's R.NET which would allow you to execute the load function, then get the saved variables from the environment, maybe? My guess is you'll need to run something like
engine.Evaluate("load('/my/data/dir/mydata.RData')");
var data = engine.GetSymbol("myvariablename");
This question already has answers here:
Closed 11 years ago.
Possible Duplicates:
Parsing JSON objects to c#
What JSON library works well for you in .NET?
Is there a class for parsing JSON objects like XDocument for XML? If not what's the easiest way to parse and use JSON objects in C# 4.0?
How about using JSON.NET?
Examples on their website :-)
There are many library for json parsing in any language , and also there are many libraries for .net languages.You better to have a look at the bottom of this page:
here