I think your problem is associated with the File.ReadAllText
. The syntax of this method is the following:
public static string ReadAllText(string path)
I doubt that 1.8.8.json
is a path.
You could try to use the following:
var path = Path.Combine(Application.StartupPath,"1.8.8.json");
var libs = JsonConvert.DeserializeObject<Library>File.ReadAllText(path);
However, even this change will not solve your problem ! Please have a careful look at the file, which is served if we request the url you have mentioned. How this structure is associated with a JSON object, which has a property called name
?
Furthermore, even if you fix this, what does the following?
The libs
, if all goes well, is an instance of the class Library
. It isn't an IEnumerable<T>
, in order to iterate through it.
foreach (var item in libs.name) { textBox1.Text += item; }
This would have made sense, if you had something like the following:
var libs = JsonConvert.DeserializeObject<IEnumerable<Library>>File.ReadAllText(path);
In other words, if after the parsing of the file in the specified path you had a sequence of Library
objects.