How can I JSON encode an array in VB.NET?

35,122

Solution 1

Dim serializer as New JavaScriptSerializer()
Dim arrayJson as String = serializer.Serialize(myArray)

Solution 2

You are going to want to look into JSON serialization. Here is a good article that explains one way to do it (unfortunately the examples are in C#) but with more information we can probalby steer you towards the right toolkit.

Share:
35,122
pixeldev
Author by

pixeldev

Developer

Updated on July 25, 2020

Comments

  • pixeldev
    pixeldev almost 4 years

    I need to pass back a JSON result for a routine I am working with. In VB.NET, how can arrays be JSON encoded?

  • Sameer Alibhai
    Sameer Alibhai over 12 years
    using System.Web.Script.Serialization;
  • Ashish Kumar
    Ashish Kumar about 4 years
    The link that you are referring to is dead.