How to get the json data from url using xamarin cross platform development.
Asked
Active
Viewed 1,669 times
1
-
possible duplicate of [Using xamarin to retrieve JSON message from URl and show in table view](http://stackoverflow.com/questions/26606824/using-xamarin-to-retrieve-json-message-from-url-and-show-in-table-view) – Jason Oct 28 '14 at 14:29
-
You just asked this same question a few hours ago. Please do not post duplicates. – Jason Oct 28 '14 at 14:30
-
@Jason sorry just now only i saw that. I forgot that because no one answered that question. that's y only. – Satheesh Natarajan Oct 28 '14 at 14:43
-
@Jason could you know the answer for this – Satheesh Natarajan Oct 30 '14 at 09:19
-
You accepted the answer in your other question. What do you still need help with? – Jason Oct 30 '14 at 12:00
-
sorry, unfortunately by mouse clicking it was accepted. still i didn't get proper answer. – Satheesh Natarajan Oct 30 '14 at 13:11
1 Answers
1
private const string Url = "http://www.nactem.ac.uk/software/acromine/dictionary.py?sf={0}";
public async Task<List<RootObject>> GetResult(string SearchString)
{
try
{
var client = new HttpClient();
var json = await client.GetStringAsync(string.Format(Url, SearchString));
return JsonConvert.DeserializeObject<List<RootObject>>(json.ToString());
}
catch (System.Exception exception)
{
return null;
}
}
using HttpClient
call url and getStrinAsyncc
to get string from the url. using DeserializeObject
to convert the string into json format.
For refer more click here to see complete program in xamarin

valdetero
- 4,624
- 1
- 31
- 46

Satheesh Natarajan
- 459
- 2
- 7
- 31