+ 4
I'm using webClient to get json object from site how can I convert it into something readable in C#?
this is the code... using (var wb = new WebClient()) { var data = new NameValueCollection(); data["chat_id"] = "12345678"; data["text"] = "myPassword"; var response = wb.UploadValues(url, "POST", data); Console.WriteLine(response); }
4 Respostas
+ 2
thank a lot... that was helpfull
how can I be sure if the response is json?
all answers from this site is json but maybe c# convert it into string auotomaticly
I can check the type but c# dosnt recognise json...
+ 1
You can use newtonsoft external library and create a create a JObject
ex:
JObject jObj = JObject. Parse(response);
var chatid = jObj["chat_ID"];
var text = jObj["text"];
Note: response object should be in json
0
What are you trying to do here?
What I can assume from your code is that, you're posting the data to a service and the server inturn sending you the reponse (will be available on var response object)
0
is talking about API
I'm calling API with some data and I'm getting an answer in json and then I'm proccessing the json.. .