Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How can Xamarin.Forms class access JSON from REST WCF service?

vmhatupvmhatup Member
edited February 2019 in Xamarin.Forms


I'm learning all about Xamarin.Forms, so please bear with me. This may seem like a simple question, but finding a solution has been an uphill battle.

This code snippet is from a class in my Xamarin.Forms project that loops through a json stream. I use the Newtonsoft library for the json:

string ar = string ar = "[{\"lon\":-66.105700,\"lat\":18.466333},{\"lon\":-65.827300,\"lat\":18.149683},{\"lon\":-65.961975,\"lat\":18.380102}]";
var obj = JsonConvert.DeserializeObject(ar);
string lat = string.Empty;
string lon = string.Empty;

foreach (var item in ((JArray)obj))
    lat = item.Value<string>("lat");
    lon = item.Value<string>("lon");

This works as expected.

Now, instead of being that string, it will be the string returned by calling URL http//IP/Service1.svc/GetTableData (the forum doesn't let me post URLs). This URL will return the same string format that was used in the snippet above:


My question: How can my class in the Xamarin.Forms project call the URL and read the string being returned? I only have access to the URL, so I can't add it to my project as a service reference.

I'm using Visual Studio 2017.

Any help is appreciated.

Best Answer


  • vmhatupvmhatup Member


Sign In or Register to comment.