[기타] [vb.net] JSON 기본 정리

하나를하더라도최선을
2021-02-08 17:17
3,811
0
본문
Imports Newtonsoft.Json
Dim Result as String = [JSON_문자열]
Dim tmpJson as JObject = JObject.Parse(Result)
Dim tmp as String = tmpJson([key])
반대로
Dim tmpJson As New JObject()
With tmpJson
.Add("A", A_Value)
.Add("B", B_value)
End With
Dim tmp as String = tmpJson.ToString()
아래와 같은 방법을 활용할 수 있습니다.
Dim json As Object
json = New With {Key .key1 = "value1", .key2 = "value2"}
MsgBox(json.ToString)
Dim json As Object
json = New With {Key .list = {"foo", "bar"}}
MsgBox(JsonConvert.SerializeObject(json))
댓글목록0