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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:59:10+00:00 2026-05-18T21:59:10+00:00

I have an issue where if my json file looks like this { Numbers:

  • 0

I have an issue where if my json file looks like this

{ “Numbers”: “45387”, “Words”: “space buckets”}

I can read it just fine, however if it looks like this:

{ “Main” :{ “Numbers”: “45387”, “Words”: “space buckets”},
“Something” :{“Numbers”: “12345”, “Words”: “Kransky”} }

I get no information back. I have no idea how to switch between Main and Something!
Loading a JSON with this ‘nested’ information using this code,

var ser = new DataContractJsonSerializer(typeof(myInfo));

var info = (myInfo)ser.ReadObject(e.Result); 

// The class being using to hold my information

[DataContract] 
public class myInfo 
{ 
    [DataMember(Name="Numbers")] 
    public int number 
    { get; set; } 

    [DataMember(Name="Words")] 
    public string words 
    { get; set; } 
} 

Causes the class to come back empty.
I’ve tried adding the group name to DataContract eg. [DataContract, Name=”Main”] but this still causes the classes values to be empty.
I’ve also tried adding “main” to the serializer overloader eg. var ser = new DataContractJsonSerializer(typeof(myInfo), “Main”);
This causes an error: Expecting element ‘Main’ from namespace ”.. Encountered ‘Element’ with name ‘root’, namespace ”.
I’d prefer to just use the supplied json reader. I have looked into json.NET but have found the documentation to be heavy on writing json and sparse with information about reading.
Surely I’m missing something simple here!

  • 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-18T21:59:11+00:00Added an answer on May 18, 2026 at 9:59 pm

    You could add a wrapper class:

    [DataContract]
    public class Wrapper
    {
        [DataMember]
        public myInfo Main { get; set; }
    
        [DataMember]
        public myInfo Something { get; set; }
    }
    

    Now you could deserialize the JSON back to this wrapper class and use the two properties to access the values.

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

Sidebar

Related Questions

I have a text file that is formatted like JSON, but in a print/view
i have encountered a very strange issue: i use json.dump to write a file
I have an issue regarding to auto populating a select dropdown from jQuery/JSON data
I have been working on a json decode issue (which I have already had
The app I am working on needs to read a JSON file that may
Just cant figure it out. I have a large object stored as a JSON
Hi i'm trying to get the content from a json file, but i can't
I have a standard file upload script using this script. When the upload is
I have an issue and this is not something that I have ever used
I have an app that grabs (async) a JSON file on the network during

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.