-1

What's the best way to populate a Chilkat JsonArray with values from a List

List<int> MyList = new List<int> { 1, 2, 3, 4, 5 };

Chilkat.JsonArray jsonArray = new Chilkat.JsonArray();

Can I do jsonArray.Load(???) or do I have to loop through the list with JsonArray.AddIntAt?

BTW I'm a C# newbie!

1 Answers1

0

I remember using Chilkat back in VB6. Are you tied to it?

If not then I would suggest maybe looking at using Newtonsoft.Json (available from NuGet).

Here is an answer that I posted from earlier today...

Hope this helps

Glynn Hurrell
  • 602
  • 6
  • 10
  • Only tied to it as I already know it. There's enough to learn with C# and .NET Core 8-) – Mike Walker May 04 '20 at 08:29
  • To be honest, I would suggest using Newtonsoft.JSON instead as its pretty much the de facto JSON de/serialiser out there for .NET, although Microsoft have now made their own (System.Text.Json) which is pretty much the same. If you go to NuGet, it will likely be the top hit. To start, check out here...https://www.newtonsoft.com/json/help/html/SerializingJSON.htm or for Microsofts ... https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-how-to – Glynn Hurrell May 04 '20 at 09:15