+ 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); }

21st Aug 2016, 3:16 PM
avy7352
avy7352 - avatar
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...
12th Sep 2016, 6:45 AM
avy7352
avy7352 - avatar
+ 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
11th Sep 2016, 6:34 AM
Ramesh Vaasu
Ramesh Vaasu - avatar
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)
12th Sep 2016, 8:05 AM
Ramesh Vaasu
Ramesh Vaasu - avatar
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.. .
12th Sep 2016, 10:10 AM
avy7352
avy7352 - avatar