Windows 8'de json ayrıştırmak için birden çok yolu denedim ve bu hatayı çok alıyorum.Ayrıştırma Json Windows8
"WinRT bilgi: WEB_E_INVALID_JSON_STRING"
O ben aynı json dize kullanmak bir noktaya gelmişse ve (daha fazla veya daha az) i web ondan okursanız çalışır, ancak çalışmaz eğer yerel bir dosyadan okursam. Yani bu işleri
public async void ExamineJson()
{
string responseText = await GetjsonStream();
ParseJson(responseText);
}
public async Task<string> GetjsonStream()
{
HttpClient client = new HttpClient();
string url = "http://rmarinho.facilit.us/app/d/rtp/config.json";
HttpResponseMessage response = await client.GetAsync(url);
return response.Content.ReadAsString();
}
private static void ParseJson(string responseText)
{
JsonObject root = new JsonObject(responseText);
string epg = root.GetNamedString("epgurl");
JsonArray themes = root["themes"].GetArray();
for (int i = 0; i < themes.Count; i++)
{
JsonObject section = themes[i].GetObject();
}
}
, ama aynı ayrıştırma yöntemi kullanmak ve bu kodu kullanırsanız hata failswith eğer benim app yerel dosyadan dosyayı almak için:
heres kod web okumak için "WinRT bilgisi: WEB_E_INVALID_JSON_STRING".
Bu, önizleme sürümünden bir hata mı yoksa eksik bir şey mi?
Şimdiden teşekkürler
Basit bir birim testi çalışmıyor mu? – leppie
Aynı dizgenin olduğundan kesinlikle emin misiniz? Dosyanız hangi kodlamayı kullanıyor? –
evet aynı dizedir .. görsel olarak karşılaştırdım ve kod gibi dize gibi xFromserver == dize yFromlocal true ... Dosyayı yerel bir kaynaktan okuduğumda dosya içerik türü ile bir şey olup olmadığını merak ediyorum .. Sorunları olan tek kişi ben değilim: http://phil-it.org/chris/?p=769 –