反序列化Json数组字典对

时间:2019-03-05 23:23:50

标签: vb.net json.net

我已经检查了Deserializing a JSON dictionaryDeserialize json to list of KeyValue pairs

他们没有完全回答我的问题。我的JSON数据格式为

[{"Question":{"Id":1,"SecretQuestion":"Which city were you born"},"Id":1,"SecretAnswer":"ABCD"}]

我上课

<JsonProperty(PropertyName:="secretQuestion")>
    Private _secretQuestion As String

    <JsonProperty(PropertyName:="secretAnswer")>
    Private _secretAnswer As String

    <JsonProperty(PropertyName:="hintsId")>
    Private _hintsId As Integer

    <JsonIgnore>
    Public Property SecretQuestion() As String
        Get
            Return Me._secretQuestion
        End Get
        Set
            Me._secretQuestion = Value
        End Set
    End Property

    <JsonIgnore>
    Public Property SecretAnswer() As String
        Get
            Return Me._secretAnswer
        End Get
        Set
            Me._secretAnswer = Value
        End Set
    End Property

    <JsonIgnore>
    Public Property HintsId() As String
        Get
            Return Me._hintsId
        End Get
        Set
            Me._hintsId = Value
        End Set
    End Property

存储秘密问题和答案的值以及第一个ID。我已经尝试了一些针对SO提出的反序列化方法,但似乎都无法正常工作

0 个答案:

没有答案