Unexpected character encountered while parsing value: <. Path ”, line 0, position 0.

You may encounter “Unexpected character encountered while parsing value: <. Path '', line 0, position 0." when trying to parse Json result that are downloaded from the WebClient method if the data is compressed in GZip. This is because WebClient does not decompress the data downloaded.

Thankfully the GZipWebClient library from Morten Nielsen aim to solve this problem. And surprisingly it is very easy in using this library. Simply get the library from Nuget(provided in the link below). Thereafter replace WebClient with GZipWebClient. Yes, it is just that simple.

On a side note, this library does seem to improve the performance of my existing app given that a smaller payload mean data load faster especially on slower network.

Referenced from Jeff Wilcox
Download GZipWebClient library from Nuget

Advertisements
This entry was posted in C#, Json, Windows Phone and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s