I have a working JSON deserializer, but a JSON file with a url. How can I recreate this and make it work with a local JSON file? The file is at the root of my application, next to my MainActivity.
This is the working URL code:
var client = new WebClient();
var response = client.DownloadString(new Uri("http://www.mywebsite.nl/form.json"));
List<Question> questions = JsonConvert.DeserializeObject<List<Question>>(response);
foreach(Question question in questions)
{
if (question.type == "textField") {
var editText = new EditText (this);
editText.Text = "This is question: " + question.id + ".";
editText.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,ViewGroup.LayoutParams.WrapContent);
layout.AddView (editText);
}
}
source
share