Json C#JObject.Parse错误

Json C#JObject.Parse错误,json,json.net,Json,Json.net,我得到以下异常: Newtonsoft.Json.JsonReaderException in Newtonsoft.Json.dll ("Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1."). Exception thrown: 'Newtonsoft.Json.JsonReaderException'

我得到以下异常:

Newtonsoft.Json.JsonReaderException in Newtonsoft.Json.dll ("Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1."). Exception thrown: 'Newtonsoft.Json.JsonReaderException' in Newtonsoft.Json.dll ("Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1.
代码如下:

JObject data = JObject.Parse(verigetir(veri.getir(), "cari_ip_alma.php"));

public string verigetir(string veri, string sayfa)
{
    string postData;

    WebRequest request = WebRequest.Create(server + sayfa);
    request.Method = "POST";
    postData = veri;
    byte[] byteArray = Encoding.UTF8.GetBytes(postData);
    request.ContentType = "application/x-www-form-urlencoded";
    request.ContentLength = byteArray.Length;
    Stream dataStream = request.GetRequestStream();
    dataStream.Write(byteArray, 0, byteArray.Length);
    dataStream.Close();
    WebResponse response = request.GetResponse();
    dataStream = response.GetResponseStream();
    StreamReader reader = new StreamReader(dataStream);

    return reader.ReadToEnd();

    reader.Close();
    dataStream.Close();
    response.Close();
}

class parametreOlustur
{
    public string data;

    public void birlestir(string a, string b)
    {
        data += "&" + a + "=" + b;
    }

    public string getir()
    {
        return data;
    }
}
PHP代码:


如果我要将php代码$row=$sql->fetchAll(PDO::FETCH_ASSOC)fetchAll更改为fetchAll,则程序正在工作,但正在获取第一个数据。

格式化,内联源代码示例能否包含正在解析的输入数据?这可能就是问题所在。另外,我注意到您在关闭流之前从
verigetir
返回。你应该得到一个构建警告…我只是想得到所有mssql表数据你的JSON根容器是一个数组而不是一个对象。有关如何修复的信息,请参阅。如果您事先不知道JSON是否表示对象或数组,请参阅了解如何修复。为了给您提供任何具体帮助,我们需要一个显示您试图解析的JSON的语句。与实际问题无关,您需要学习使用该语句来处理诸如
reader
dataStream
response
之类的一次性文件。