skip to Main Content

C# Problem deserialize XML into JSON array

I have the following XML <table> <name>Table 1</name> <headers> <header>Header 1</header> <header>Header 2</header> </headers> <data> <row> <row_item>Item 1</row_item> <row_item>Item 2</row_item> </row> <row> <row_item>Item 3</row_item> <row_item>Item 4</row_item> </row> </data> </table> Now I can deserialize this easy enough using the built in…

VIEW QUESTION

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