skip to Main Content

Deserialising a JSON array collection issues VB .NET

Getting the following error Newtonsoft.Json.JsonSerializationException: 'Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly. To fix this error either change the JSON to a JSON array…

VIEW QUESTION

Can someone help me use this Json file in c#?

I have been trying to display contents of a json file in a textbox for the past 6 hours and got nowhere. here's the c# code private thruster Getthruster() { string text = File.ReadAllText(@"./thrusters.json"); List<thruster> test = JsonConvert.DeserializeObject<List<thruster>>(text); textBox1.Text =…

VIEW QUESTION

Json – Converting jarray to IEnumerable gives "does not contain a definition for Concat"

I've got the following code: using System; using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; public class Program { public static void Main() { var json = JsonConvert.DeserializeObject<dynamic>("["test1", "test2"]"); var list = json.ToObject<IEnumerable<string>>().Concat(new[] { "test3" }); Console.WriteLine(string.Join(", ", list)); } } I…

VIEW QUESTION
Back To Top
Search