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

  • Home
  • SEARCH
  • 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 9197015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:58:44+00:00 2026-06-17T21:58:44+00:00

I’m trying to write a ticker against Mt Gox’s Http API. It returns JSON

  • 0

I’m trying to write a ticker against Mt Gox’s Http API. It returns JSON that looks like this:

{
"result":"success",
"return":
 {
 "high": {"value":"5.70653","value_int":"570653","display":"$5.70653","currency":"USD"},
 "low": {"value":"5.4145","value_int":"541450","display":"$5.41450","currency":"USD"},
 "avg": {"value":"5.561119626","value_int":"556112","display":"$5.56112","currency":"USD"},
 "vwap": {"value":"5.610480461","value_int":"561048","display":"$5.61048","currency":"USD"},
 "vol": {"value":"55829.58960346","value_int":"5582958960346","display":"55,829.58960346\u00a0BTC","currency":"BTC"},
 "last_all":{"value":"5.5594","value_int":"555940","display":"$5.55940","currency":"USD"},
 "last_local":{"value":"5.5594","value_int":"555940","display":"$5.55940","currency":"USD"},
 "last_orig":{"value":"5.5594","value_int":"555940","display":"$5.55940","currency":"USD"},
 "last":{"value":"5.5594","value_int":"555940","display":"$5.55940","currency":"USD"},
 "buy":{"value":"5.53587","value_int":"553587","display":"$5.53587","currency":"USD"},
 "sell":{"value":"5.56031","value_int":"556031","display":"$5.56031","currency":"USD"}
 }
}

I’m trying to cast that information into an object. I’ve made a set of classes that look like this:

[DataContract]
class MtGoxResponse
{
    public string result { get; set; }
    [DataMember(Name="return")]
    public Resp Resp { get; set; }
}

[DataContract]
class Resp
{
    public HLA high { get; set; }
    public HLA low { get; set; }
    public HLA avg { get; set; }
    public HLA vwap { get; set; }
    public HLA vol { get; set; }
    public HLA last_all { get; set; }
    public HLA last_local { get; set; }
    public HLA last_orig { get; set; }
    public HLA last { get; set; }
    public HLA buy { get; set; }
    public HLA sell { get; set; }
}

[DataContract]
class HLA
{
    public double value { get; set; }
    public int value_int { get; set; }
    public string display { get; set; }
    public string currency { get; set; }
}

Result comes through fine every time, but Resp is always null. Am I missing something with the DataContract attributes? I’m assuming the root cause is the object’s name, but surely there’s a way around it.

  • 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-06-17T21:58:46+00:00Added an answer on June 17, 2026 at 9:58 pm

    I’m not sure exactly why your [DataMember] attribute isn’t working. From what I’ve read, [DataMember] appears to be interpreted differently per implementation of serializers, so it may well be a bug.

    However, you can remove the need of using it by simply using the @ sign before return, like so:

    [DataContract]
    class MtGoxResponse
    {
        public string result { get; set; }
        public Resp @return { get; set; }
    }
    

    This prefix is mentioned somewhat passively on MSDN’s page for C# keywords.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
I'm trying to create an if statement in PHP that prevents a single post
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display

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.