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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:43:26+00:00 2026-06-18T09:43:26+00:00

I have some JSON Data which looks like this: { response:{ _token:StringValue, code:OK, user:{

  • 0

I have some JSON Data which looks like this:

{
   "response":{
   "_token":"StringValue",
   "code":"OK",
   "user":{
     "userid":"2630944",
     "firstname":"John",
     "lastname":"Doe",
     "reference":"999999999",
     "guid":"StringValue",
     "domainid":"99999",
     "username":"jdoe",
     "email":"jdoe@jdoe.edu",
     "passwordquestion":"",
     "flags":"0",
     "lastlogindate":"2013-02-05T17:54:06.31Z",
     "creationdate":"2011-04-15T14:40:07.22Z",
     "version":"3753",
     "data":{
       "aliasname":{
         "$value":"John Doe"
       },
       "smsaddress":{
         "$value":"5555555555@messaging.sprintpcs.com"
       },
       "blti":{
         "hideemail":"false",
         "hidefullname":"false"
       },
       "notify":{
         "grades":{
            "$value":"0"
          },
          "messages":{
            "$value":"1"
          }
       },
       "beta_component_courseplanexpress_1":{
         "$value":"true"
       }
    }
  }
}

I am using C# with JSON.NET to parse through the data. I’ve been able to sucessfully get data using this algorithm:

User MyUser = new User();
JToken data = JObject.Parse(json);
MyUser.FirstName = (string) data.SelectToken("response.user.firstname");
//The same for all the other properties.

The problem is with the data field. This field is based on user preferences mostly and data is only inserted as it is used. The fields are all custom and developers can put in as many as they want without restrictions. Essentially, it’s all free form data. Also as you notice they can be nested really far with data.

I’ve tried to run:

MyUser.Data = JsonConvert.DeserializeObject<List<JToken>>((string) data.SelectToken("response.user.data");

which doesn’t work.

How would you go about converting it to be used in a C# object?

  • 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-18T09:43:27+00:00Added an answer on June 18, 2026 at 9:43 am

    You can access it via the JToken / JArray / JObject methods. For example, this will list all of the keys under the data:

    public class StackOverflow_14714085
    {
        const string JSON = @"{
                              ""response"": {
                                ""_token"": ""StringValue"",
                                ""code"": ""OK"",
                                ""user"": {
                                  ""userid"": ""2630944"",
                                  ""firstname"": ""John"",
                                  ""lastname"": ""Doe"",
                                  ""reference"": ""999999999"",
                                  ""guid"": ""StringValue"",
                                  ""domainid"": ""99999"",
                                  ""username"": ""jdoe"",
                                  ""email"": ""jdoe@jdoe.edu"",
                                  ""passwordquestion"": """",
                                  ""flags"": ""0"",
                                  ""lastlogindate"": ""2013-02-05T17:54:06.31Z"",
                                  ""creationdate"": ""2011-04-15T14:40:07.22Z"",
                                  ""version"": ""3753"",
                                  ""data"": {
                                    ""aliasname"": {
                                      ""$value"": ""John Doe""
                                    },
                                    ""smsaddress"": {
                                      ""$value"": ""5555555555@messaging.sprintpcs.com""
                                    },
                                    ""blti"": {
                                      ""hideemail"": ""false"",
                                      ""hidefullname"": ""false""
                                    },
                                    ""notify"": {
                                      ""grades"": {
                                        ""$value"": ""0""
                                      },
                                      ""messages"": {
                                        ""$value"": ""1""
                                      }
                                    },
                                    ""beta_component_courseplanexpress_1"": {
                                      ""$value"": ""true""
                                    }
                                  }
                                }
                              }
                            }";
    
        public static void Test()
        {
            var jo = JObject.Parse(JSON);
            var data = (JObject)jo["response"]["user"]["data"];
            foreach (var item in data)
            {
                Console.WriteLine("{0}: {1}", item.Key, item.Value);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data in JSON format which looks like this: {YrMonth:201109,StrYrMonth:Sep-2011,Value:49275.14} {YrMonth:201110,StrYrMonth:Oct-2011,Value:52087.22} etc...
Inside my .aspx I have some JSON code that looks like this: function someFunctionName()
I have some JSON which looks generally like this... {appJSON: [ { title:Application Title,
I have a REST api which dumps some json data (user info, etc). Now
I have some data and need to create a json file with this structure
I have some html code which is loaded by reading some json. Inside that
Here's an interesting problem: I have some jQuery that looks like this: $(document).ready(function() {
I have an HTTP Server which responses with JSON strings. They look like this:
In Backbone, I have a collection which is populated with some JSON data which
I have JSON that looks like this: { ROLE_NAME: { FOO: { download_url: http:

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.