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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:13:18+00:00 2026-06-04T05:13:18+00:00

In one of my project i want to parse a JSON array with different

  • 0

In one of my project i want to parse a JSON array with different key name. For Example

{ "details": [ 
    { "state": "myState1",
      "place": [
        { "name": "placeName" } ] },
    { "state": "myState2",
      "place": [
        { "name1": "placeName" } ] },
    { "state": "myState3", 
      "place": [
        { "name2": "placeName" } ] } }

So in this JSON please look at the place array. each time key like name1,name2,name3…,
.And also it is not necessary to get the same JSON at all the time. In some time only state1 or state1 and state3 and in some time state1 to state 50.

So how can i identify and parse exact data from this array

  • 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-04T05:13:20+00:00Added an answer on June 4, 2026 at 5:13 am

    First of all your JSON is not well-formatted. You miss a closing square bracket ] before the last closing curly bracket }.

    Then, you can’t parse variable-name properties to a static class, but you can turn them into a dictionary. Here’s an example of mapping classes that work with variable places:

    public class Details
    {
        public string state { get; set; }
        public List<Dictionary<string, string>> place { get; set; }
    }
    public class Wrap
    {
        public Details[] details { get; set; }
    }
    
    static void Main(string[] args)
    {
        string txt = File.ReadAllText("MyJSONFile.txt");
        JavaScriptSerializer ser = new JavaScriptSerializer();
        var data = ser.Deserialize<Wrap>(txt);
    }
    

    If also the place property will change name, I think the simplest way to parse it is to use the following, very loosely typed, class:

    public class Wrap
    {
       public List<Dictionary<string,object>> details { get; set; }
    }
    

    where the object in the dictionary will be a string or a dictionary of properties according to the values in the JSON.

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

Sidebar

Related Questions

I want to make one project that parse wiki pages and get needed information
i need to have one project on asp.net mvc 1 but i want to
I want to imitate in my project one of apple's pages behaviors (best viewed
I created one GWT webapplication project.Inthat i want to create servlet program,but in that
I want to create unit tests for one of my project's classes but I'm
I have a website project that I want to build using CruiseControl.net. On one
I want to merge one .NET DLL assembly and one C# Class Library project
Quick Explanation One Silverlight (3.0) project with several XAML pages. I want to load
I am working on UISplitview base project.I have one problem regarding UISplitview.I want to
I want to parse a Feedburner feed with HtmlUnit. The feed is this one:

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.