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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T00:09:46+00:00 2026-05-21T00:09:46+00:00

H chaps, I am trying to use ServiceStack.Text for JSON parsing (it seems to

  • 0

H chaps,
I am trying to use ServiceStack.Text for JSON parsing (it seems to be performing better than JSON.Net in various benchmarks I have seen). But I am not getting the results I am expecting. The class I am attempting to deserialize looks like this:

[DataContract]
public class RpcRequest<T>
{
    [JsonProperty("id")]
    [DataMember(Name="id")]
    public String Id;

    [JsonProperty("method")]
    [DataMember(Name="method")]
    public String Method;

    [JsonProperty("params")]
    [DataMember(Name="params")]
    public T Params;

    [JsonIgnore]
    [IgnoreDataMember]
    public Policy Policy;
}

And I am invoking the parser like this

public static class Json
{
    public static T Deserialize<T>(string serialized)
    {
        return TypeSerializer.DeserializeFromString<T>(serialized);
    }
}
...
RpcRequest<Params> myRequeset = Json.Deserialize(packet);

However I am getting an instance back from that call which has none of the values set. ie Id, Method and Params are all null. Am I using this API correctly?

  • 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-21T00:09:47+00:00Added an answer on May 21, 2026 at 12:09 am

    It seems that ServiceStack does not support public fields, only public properties. So if I change my model object to the following it all works.

    [DataContract]
    public class RpcRequest<T>
    {
        [JsonProperty("id")]
        [DataMember(Name="id")]
        public String Id { get; set; }
    
        [JsonProperty("method")]
        [DataMember(Name="method")]
        public String Method { get; set; }
    
        [JsonProperty("params")]
        [DataMember(Name="params")]
        public T Params { get; set; }
    
        [JsonIgnore]
        [IgnoreDataMember]
        public Policy Policy { get; set; }
    }
    

    Note the addition of getters and setters to each property.

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

Sidebar

Related Questions

I have build a jar file and trying to use it in j2me application.
I'm trying to use a URL matching regular expression that I got from http://daringfireball.net/2010/07/improved_regex_for_matching_urls
I have 145064642 chars long HTML String which I am trying to print. When
i'm trying to use the terminal from python VTE binding (python-vte from debian squeeze)
I'm trying to use urls on my site like example.com/@lorem-ipsum-dolor instead of example.com/tag/lorem-ipsum-dolor form.
I am trying to use a UIImage with stretchableImageWithLeftCapWidth to set the image in
I am trying to use sessions for the first time and would like to
I am trying to use textwrap to format an import file that is quite
I am trying to use the stock standard win32com approach to drive Excel 2007
Dear Stackoverflowers, I am trying to build a simple web application in ASP.NET where

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.