[.Net] JSonSerializer, classe pour sérialiser vos objets

Voila une classe dotnet bien pratique qui permet de sérialiser des objets en json.

Imports System.IO
Imports System.Text
Imports System.Runtime.Serialization

Public Class JSONSerializer
    Public Shared Function Serialize(ByVal BaseType As Object) As String
        Dim ExactName As String = BaseType.GetType.ToString
        Dim Ser As String = p_Serialize(BaseType)
        Dim oList As New List(Of String)
        oList.Add(ExactName)
        oList.Add(Ser)
        Return p_Serialize(oList)
    End Function
    Public Shared Function Deserialize(ByVal s As String) As Object
        Dim oList As New List(Of String)
        oList = DirectCast(p_Deserialize(s, oList), List(Of String))
        Dim Instance As Object = Nothing
        Instance = Activator.CreateInstance(Type.GetType(oList.Item(0)))
Read more