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 5992075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:28:45+00:00 2026-05-22T23:28:45+00:00

The response is structured like this, this is an extract, might be missing a

  • 0

The response is structured like this, this is an extract, might be missing a curly brace:

{"2":{"date":1306411951,"price":4.8003,"low":"4.80000000","high":"4.80060000","nicedate":"15:12"},"6":{"date":1306418941,"price":4.654175,"low":"4.40000000","high":"4.80000000","nicedate":"17:02"}

And I get cast exceptions when parsing the response string even though all the datamembers in the object are strings.

I’m using System.Runtime.Serialization.Json to deserialize the objects.

Right now I’m doing it like this:

        Currency[] MapJSONToObjects(string jsonString)
    {
        using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(jsonString)))
        {
            //Parse
            var ser = new DataContractJsonSerializer(typeof(Currency[]));
            Currency[] currencies = (Currency[])ser.ReadObject(ms);
            return currencies;
        }
    }
  • 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-22T23:28:46+00:00Added an answer on May 22, 2026 at 11:28 pm

    As mentioned already, you’re missing a trailing } from the JSON. Assuming that what you receive is properly formatted and consistent JSON, then your Currency class should look something like this:

    [DataContract]
    public class Currency
    {
        [DataMember(Name = "date")]
        public int Date { get; set; }
        [DataMember(Name = "price")]
        public double Price { get; set; }
        [DataMember(Name = "low")]
        public string Low { get; set; }
        [DataMember(Name = "high")]
        public string High { get; set; }
        [DataMember(Name = "nicedate")]
        public string NiceDate { get; set; }
    }

    Your deserialization code looks fine, though you could consider using JSON.NET if you’re still having problems, as described here: Deserializing variable Type JSON array using DataContractJsonSerializer

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

Sidebar

Related Questions

Right now I've got a mod_wsgi script that's structured like this.. def application(environ, start_response):
In @mmalc's response to this question he states that In general you should not
Based on the response to this question: Why does C++ have header files and
I'm working with Facebook API and it's search method returns a JSON response like
I have a table that looks like this: <22 23-27 8-10 1.3 1.8 11-13
I have a resultset structure like this ID Value Name 1 Oranges Reponse 1
I have a class like this: [Serializable] public class Structure { #region Constants and
I am attempting to print a JSON that I get like this: jsonfields =
I have a structure like this WebUI project - controllers, views Framework project- repositories,service
So i have all these links in html like this <a href=#ajax class=invlink competition_id=532>Gen

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.