多名称数据连接

Multi name data connection

我的 json 数据来自 getir.json

{"name":"muro","id":"1","firma_adi":"hizli.mobi","link":"http:\/\/www.porn.com","text":"mobil adult porn"}
{"name":"muro","id":"1","firma_adi":"rek.mobi","link":"http:\/\/www.redtube.com","text":"mobil adult porn"}
{"name":"muro","id":"1","firma_adi":"mobil.list","link":"http:\/\/www.youporn.com","text":"mobil adult porn"}

vb.net json split using but problem this

    Dim webClient As New System.Net.WebClient
    Dim result As String = webClient.DownloadString("reklamatik/?uye=1")

    Dim ser As New System.Web.Script.Serialization.JavaScriptSerializer
    Dim results As JSON_resultArray = DirectCast(ser.Deserialize(Of JSON_resultArray)(result), JSON_resultArray)

    Console.WriteLine(results.Vars(1).name)

Public Class JSON_result
    Public name As String

End Class

Public Class JSON_resultArray
    Public Vars() As JSON_result
End Class

不工作多 json 数据

这个屏幕来自我的电脑vb 2012 studio

您的 JSON 无效,顺便说一句,对于有效的 JSON,您应该这样做

VB

Dim data = "[{""name"":""muro"",""id"":""1"",""firma_adi"":""hizli.mobi"",""link"":""http:\/\/www.porn.com"",""text"":""mobil adult porn""}," & vbCr & vbLf & "                        {""name"":""muro"",""id"":""1"",""firma_adi"":""rek.mobi"",""link"":""http:\/\/www.redtube.com"",""text"":""mobil adult porn""}," & vbCr & vbLf & "                        {""name"":""muro"",""id"":""1"",""firma_adi"":""mobil.list"",""link"":""http:\/\/www.youporn.com"",""text"":""mobil adult porn""}]"


Dim ser = New System.Web.Script.Serialization.JavaScriptSerializer()
Dim p = ser.Deserialize(Of List(Of JsonItem))(data)

映射你的JSON元素的class:

Public Class JsonItem
    Public Property name As String

    Public Property id As String

    Public Property firma_adi As String

    Public Property link As String

    Public Property text As String

End Class

C#

var data = @"[{""name"":""muro"",""id"":""1"",""firma_adi"":""hizli.mobi"",""link"":""http:\/\/www.porn.com"",""text"":""mobil adult porn""},
                        {""name"":""muro"",""id"":""1"",""firma_adi"":""rek.mobi"",""link"":""http:\/\/www.redtube.com"",""text"":""mobil adult porn""},
                        {""name"":""muro"",""id"":""1"",""firma_adi"":""mobil.list"",""link"":""http:\/\/www.youporn.com"",""text"":""mobil adult porn""}]";


        var ser = new System.Web.Script.Serialization.JavaScriptSerializer();
        var p = ser.Deserialize<List<JsonItem>>(data);

映射您的 JSON 元素的 class:

public class JsonItem
{
    public string name { get; set; }
    public string id { get; set; }
    public string firma_adi { get; set; }
    public string link { get; set; }
    public string text { get; set; }

}