0

我有這樣的弦​​樂器如何deserealizate手動

{\"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} 

我想轉換到這個對象

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 

我需要幫助我在Visual Studio 2005中這樣做,與scriptask的SSIS。 我不能使用JavaScriptSerializer或類似的,這必須手動。

+1

手動解碼JSON意味着編寫自己的JSON解析器。爲什麼你不能使用json庫爲你做這件事,除了所有在json字符串中轉義的引號(這會將字符串轉換爲not-json)。 –

回答

0

你真的想避免手動做這件事,我會研究json.net,它不是.net框架的一部分,應該與vs2005一起工作。 http://james.newtonking.com/json

+0

問題在於你不能添加DLL的,另外我需要在每個腳本任務中添加這個項目的所有分支。 – angel

+0

SSIS允許自定義任務,你可以使用任何你想要的.dll –