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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:08:57+00:00 2026-05-28T02:08:57+00:00

I’m having a problem parsing the JSON response sent from Yahoo! Placemaker. I only

  • 0

I’m having a problem parsing the JSON response sent from Yahoo! Placemaker. I only need the List LocalScopes.

My class definitions are the following:

public class PlacemakerResponse
{

    public Document document { get; set; }

    public class Document
    {
        public List<LocalScope> localScopes { get; set; }
    }

}

public class LocalScope
{

    public String woeId { get; set; }
    public String name { get; set; }
    public Centroid centroid { get; set; }

    public class Centroid
    {
        public String latitude { get; set; }
        public String longitude { get; set; }
    }

}

The complete JSON string is the following. I validated it at JSONLint and everything seems to be the order.

{
    "processingTime": "0.00191",
    "version": " build 110725",
    "documentLength": "36",
    "document": {
        "0": {
            "placeDetails": {
                "placeId": "1",
                "place": {
                    "woeId": "483446",
                    "type": "Town",
                    "name": "Misida, Malta Majjistral, MT",
                    "centroid": {
                        "latitude": "35.8956",
                        "longitude": "14.4892"
                    }
                },
                "placeReferenceIds": "1",
                "matchType": "0",
                "weight": "1",
                "confidence": "10"
            }
        },
        "1": {
            "placeDetails": {
                "placeId": "2",
                "place": {
                    "woeId": "2450022",
                    "type": "Town",
                    "name": "Miami, FL, US",
                    "centroid": {
                        "latitude": "25.729",
                        "longitude": "-80.2374"
                    }
                },
                "placeReferenceIds": "2",
                "matchType": "0",
                "weight": "1",
                "confidence": "10"
            }
        },
        "administrativeScope": {
            "woeId": "0",
            "type": "Undefined",
            "name": "",
            "centroid": {
                "latitude": "0",
                "longitude": "0"
            }
        },
        "geographicScope": {
            "woeId": "1",
            "type": "Supername",
            "name": "Earth",
            "centroid": {
                "latitude": "0",
                "longitude": "0"
            }
        },
        "localScopes": [
            {
                "localScope": {
                    "woeId": "483446",
                    "type": "Town",
                    "name": "Misida, Malta Majjistral, MT (Town)",
                    "centroid": {
                        "latitude": "35.8956",
                        "longitude": "14.4892"
                    },
                    "southWest": {
                        "latitude": "35.8893",
                        "longitude": "14.472"
                    },
                    "northEast": {
                        "latitude": "35.9109",
                        "longitude": "14.4986"
                    },
                    "ancestors": [
                        {
                            "ancestor": {
                                "woeId": "24551414",
                                "type": "Locality",
                                "name": "Msida"
                            }
                        },
                        {
                            "ancestor": {
                                "woeId": "56043491",
                                "type": "Region",
                                "name": "Malta Majjistral"
                            }
                        },
                        {
                            "ancestor": {
                                "woeId": "23424897",
                                "type": "Country",
                                "name": "Malta"
                            }
                        }
                    ]
                }
            },
            {
                "localScope": {
                    "woeId": "2450022",
                    "type": "Town",
                    "name": "Miami, FL, US (Town)",
                    "centroid": {
                        "latitude": "25.729",
                        "longitude": "-80.2374"
                    },
                    "southWest": {
                        "latitude": "25.5403",
                        "longitude": "-80.4469"
                    },
                    "northEast": {
                        "latitude": "25.9578",
                        "longitude": "-80.028"
                    },
                    "ancestors": [
                        {
                            "ancestor": {
                                "woeId": "12587815",
                                "type": "County",
                                "name": "Miami-Dade"
                            }
                        },
                        {
                            "ancestor": {
                                "woeId": "2347568",
                                "type": "State",
                                "name": "Florida"
                            }
                        },
                        {
                            "ancestor": {
                                "woeId": "23424977",
                                "type": "Country",
                                "name": "United States"
                            }
                        }
                    ]
                }
            }
        ],
        "extents": {
            "center": {
                "latitude": "35.8956",
                "longitude": "14.4892"
            },
            "southWest": {
                "latitude": "25.5403",
                "longitude": "-80.4469"
            },
            "northEast": {
                "latitude": "35.9109",
                "longitude": "14.4986"
            }
        },
        "referenceList": [
            {
                "reference": {
                    "woeIds": "483446",
                    "placeReferenceId": "1",
                    "placeIds": "1",
                    "start": "20",
                    "end": "25",
                    "isPlaintextMarker": "1",
                    "text": "Msida",
                    "type": "plaintext",
                    "xpath": ""
                }
            },
            {
                "reference": {
                    "woeIds": "2450022",
                    "placeReferenceId": "2",
                    "placeIds": "2",
                    "start": "30",
                    "end": "35",
                    "isPlaintextMarker": "1",
                    "text": "Miami",
                    "type": "plaintext",
                    "xpath": ""
                }
            }
        ]
    }
}

When I do: List<LocalScope> places = (ser.Deserialize<PlacemakerResponse>(stringJSON)).document.localScopes;

The places list has two LocalScope objects, as in the JSON String (so far so good), BUT all three members (woeId, name, centroid) are set to null!!

I’ve used the JavaScriptSerializer many times before and never had any problems, does anybody have any suggestions on what I’m doing wrong?

Thank you.

  • 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-28T02:08:57+00:00Added an answer on May 28, 2026 at 2:08 am

    I think you should change your class declarations as follows

    public class PlacemakerResponse
    {
    
        public Document document { get; set; }
    
        public class Document
        {
            public List<AnotherPlacemaker> localScopes { get; set; }
        }
    
    }
    
    public class AnotherPlacemaker
    {
        public LocalScope LocalScope;
    }
    
    
    public class LocalScope
    {
    
        public String woeId { get; set; }
        public String name { get; set; }
        public Centroid centroid { get; set; }
    
        public class Centroid
        {
            public String latitude { get; set; }
            public String longitude { get; set; }
        }
    
    }
    

    If you wanted to use Json.Net you could write your code as below without declaring those ugly objects

    dynamic yahooObj =  JsonUtils.JsonObject.GetDynamicJsonObject(yourstring);
    foreach (var item in yahooObj.document.localScopes)
    {
        Console.WriteLine(
            item.localScope.woeId + " " + 
            item.localScope.name + " " + 
            item.localScope.centroid.latitude + " " + 
            item.localScope.centroid.longitude);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
We're building an app, our first using Rails 3, and we're having to build
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string

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.