0

i have this strings

{\"Data\":null,\"ErrorCode\":0,\"IsSuccess\":false,\"Message\":\"No hay informacion para descargar\",\"SuccessCode\":100}

{\"Data\":{\"BranchCodes\":[\"30\"],\"ProcessId\":86},\"ErrorCode\":0,\"IsSuccess\":true,\"Message\":null,\"SuccessCode\":0}

{\"Data\":{\"BranchCodes\":[\"30\",\"97\"],\"ProcessId\":87},\"ErrorCode\":0,\"IsSuccess\":true,\"Message\":null,\"SuccessCode\":0}

i want to convert to this object

Class WorkGroupMetric
    Public Property Data() As Data
        Get
            Return m_Data
        End Get
        Set(ByVal value As Data)
            m_Data = Value
        End Set
    End Property
    Private m_Data As Data

    Public Property ErrorCode() As Integer
        Get
            Return m_ErrorCode
        End Get
        Set(ByVal value As Integer)
            m_ErrorCode = Value
        End Set
    End Property
    Private m_ErrorCode As Integer

    Public Property IsSuccess() As Boolean
        Get
            Return m_IsSuccess
        End Get
        Set(ByVal value As Boolean)
            m_IsSuccess = Value
        End Set
    End Property
    Private m_IsSuccess As Boolean

    Public Property Message() As String
        Get
            Return m_Message
        End Get
        Set(ByVal value As String)
            m_Message = Value
        End Set
    End Property
    Private m_Message As String

    Public Property SuccessCode() As Integer
        Get
            Return m_SuccessCode
        End Get
        Set(ByVal value As Integer)
            m_SuccessCode = Value
        End Set
    End Property
    Private m_SuccessCode As Integer

End Class

Public Class Data
    Public Property BranchCodes() As List(Of String)
        Get
            Return m_BranchCodes
        End Get
        Set(ByVal value As List(Of String))
            m_BranchCodes = value
        End Set
    End Property
    Private m_BranchCodes As List(Of String)
    Public Property ProcessId() As Integer
        Get
            Return m_ProcessId
        End Get
        Set(ByVal value As Integer)
            m_ProcessId = Value
        End Set
    End Property
    Private m_ProcessId As Integer
End Class

i need help i am doing this in visual studio 2005, with scriptask for ssis. i cant uses JavaScriptSerializer or similar, this must to be manually.

angel
  • 4,474
  • 12
  • 57
  • 89
  • 1
    Decoding JSON manually means writing your own JSON parser. Why can't you use a json library to do this for you, other than all the quotes being escaped in the json string (which turns the string into not-json). – Marc B Jan 08 '14 at 20:41

1 Answers1

0

You really want to avoid doing this manually, I would investigate json.net, which is not part of the .net framework and should work with vs2005. http://james.newtonking.com/json

Mike Beeler
  • 4,081
  • 2
  • 29
  • 44