VB.NET-使用Json.NET将Json转换为Xml



是否有任何可能的方法将从json到json的直接url转换为xml,将文本转换为一个文本框?

示例:

 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim Json1 as string = "http://pastebin.com/raw.php?i=p3uBzBtm"
    Dim jss = New JsonSerializer()
    Dim response2 = jss.Deserialize(Of Object)(Json1)
    textbox1.text = response2
End Sub

对不起,我是这门语言的新手。

使用此代码:

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim Json1 As String = New WebClient().DownloadString("http://pastebin.com/raw.php?i=p3uBzBtm")
    Dim str = JsonConvert.DeserializeXmlNode(Json1)
    TextBox1.Text = str.OuterXml
End Sub

对于多个节点,你会想要这样的东西:

Dim Json1 As String = "{ 'root': " & New WebClient().DownloadString("http://pastebin.com/raw.php?i=ugZrw4d6") & " }"
Dim doc As XmlDocument = JsonConvert.DeserializeXmlNode(Json1)
Dim result As String = doc.ChildNodes(0).InnerXml
TextBox1.Text = result

相关内容

  • 没有找到相关文章

最新更新