Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# JSON分析错误-位置0处的字符无效_C#_Json_Windows Runtime - Fatal编程技术网

C# JSON分析错误-位置0处的字符无效

C# JSON分析错误-位置0处的字符无效,c#,json,windows-runtime,C#,Json,Windows Runtime,我正在尝试用我的click方法解析并执行GET Using Windows.Data.Json; private async void getJSON_click(object sender,RoutedEventArgs e) { var client=new HttpClient(); client.MaxResponseBufferSize=1024*1024; var response= await Client.GetAsync(new Uri(The URL

我正在尝试用我的click方法解析并执行GET

Using Windows.Data.Json;

private async void getJSON_click(object sender,RoutedEventArgs e)

{ 
   var client=new HttpClient();
   client.MaxResponseBufferSize=1024*1024;
   var response= await Client.GetAsync(new Uri(The URL here));
   var result = await response.Content.ReadAsStringAsync();

   var component=JsonArray.Parse(result);

}
以下是错误消息- WINRT信息:位置0处的字符无效。无效的JSON字符串

这是我试图解析的JSON数据: {X-YZ-12345/AB.CD:{PM1:F,PM2:47.12}


非常感谢您的帮助。

这不是一个数组,而是一个对象。试试JsonObject


它不是数组,而是对象。试试JsonObject


您发送的编码类型是什么?您确定没有收到BOM字符吗?您发送的编码类型是什么?您确定没有获得BOM表字符吗?
string result = @"{""X-YZ-12345/AB.CD"" :{""PM1"":""F"",""PM2"":""47.12""}}";
var jobj = JsonObject.Parse(result);