Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6176397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:05:42+00:00 2026-05-24T00:05:42+00:00

I have a class in my Silverlight app that (de-)serializes JSON strings to/from an

  • 0

I have a class in my Silverlight app that (de-)serializes JSON strings to/from an object class.
I use WebClient.OpenReadAsync to get a file that contains this JSON string:

{"FirstName":"Bob","LastName":"Underwood"}

After calling OpenReadAsync however, the retrieved string has a lot of extra characters:

"PK\n\0\0\0\0\0�u�>h��5\0\0\05\0\0\0\t\0\0\0test.json\"{\\\"FirstName\\\":\\\"Gary\\\",\\\"LastName\\\":\\\"MacDonald\\\"}\"PK\0\n\0\0\0\0\0�u�>h��5\0\0\05\0\0\0\t\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0test.jsonPK\0\0\0\0\0\07\0\0\0\\\0\0\0\0\0"

This is the code I’m using to download the JSON:

WebClient client = new WebClient();
client.OpenReadCompleted += client_OpenReadCompleted;
client.OpenReadAsync(new Uri("/someJsonFile.zip", UriKind.Relative));

void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) {
    if (e.Error == null) {
        StreamReader reader = new StreamReader(e.Result);
        string jsonString =  reader.ReadToEnd().ToString();
    }
    else {
        addMessage("Error " + e.Error.ToString());
    }
}

jsonString ends up with all that extra data, so I can’t deserialize it as is.

Another thing to note: the URI points to someJsonFile.zip, but it’s really not zipped, when I give the file a extension like .json, or no extension, I get a error that it cannot find the file, but when I give it a extension like .zip, it finds it fine. Is there a way I can use a normal or no extension? I was wondering if this was a configuration issue.

Questions:

  1. Am I doing something wrong in pulling this file and using StreamReader to get the string that’s causing me to get all that trash data?

  2. Do I need to do something specific to be able to use WebClient to grab a file with different extensions, like .json, or even no extension at all?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T00:05:42+00:00Added an answer on May 24, 2026 at 12:05 am

    1 – That data stream certainly is a ZIP (PK is the old PKZip marker and the test.json filename is mentioned in its index as well).

    Your server may be setup to serve all files compressed (or you may simply be accessing an actual zip file). Please check the server settings.

    2 – As for the second question, the WebClient does not care about file types. It is just a stream of data that needs to be interpreted by something that knows what the data is (i.e. your code).

    It is only the server that may be configured to serve up different files in different ways.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight application that is built from a set of Silverlight class
I have a Silverlight Class Library that I want to use in both my
I have created a class that inherits for DomainService and have a Silverlight app
I have a Silverlight Windows Phone 7 app that pulls data from a public
I have an object that downloads a file from a server, saves it into
I have a Silverlight app that adds a Path to the LayoutRoot grid of
I have a poker blind timer Silverlight app that is losing time (after running
I have a method in a Silverlight app that currently returns an IList and
I'm Buiding a Silverlight 3 class library that needs to get a hold of
I'm writing an app where users enter records. I have a class that represents

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.