Open json file and deserialize it in Windows Phone 8.1

I have a file with a .json extention in my root folder called CurrencyCodesMap.json ,this is the content . When I try to read it and save it to a string for my NewtonSoft.JsonParsing the output tells me that “Cannot find or open the PDB file” and it doesn’t even hit the breakpoints.

Here is my reading method:

    public List<CodesMap> GetCodesMap()
    {
        List<CodesMap> CodesList = JsonConvert.DeserializeObject<List<CodesMap>>(OpenCurrencyCodesMapFile().Result);

        return CodesList;
    }

    public async Task<string> OpenCurrencyCodesMapFile()
    {
        string str = "";

        String ResourceReference = "ms-appx:///CurrencyCodesMap.json";
        StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(ResourceReference, UriKind.Absolute));
        Stream sr = await file.OpenStreamForReadAsync();
        await FileIO.ReadLinesAsync(file);

        foreach (string s in await FileIO.ReadLinesAsync(file))
        {
            str += s;
        }

        return str;
    }

Type:

public class CodesMap
{
    public string CountryCode { get; set; }
    public string CurrencyCode { get; set; }
}


Source: json

Leave a Reply