开发者

Create an object matching details for a deserialized json response

I try to deserialize a complex object that is returned by a yahoo api but i'm not very experimented. I have created a basic object but is not matching the detail of my deserialized json. Can someone help me to build the correct object that will match the returned item in this response json after deserialize. Here Json and my basic object not matching details. Thanks.

/*
# {  
# "places":{  
#   "place":[  
#     {  
#       "woeid":12521721,  
#       "placeTypeName":"Airport",  
#       "placeTypeName attrs":{  
#         "code":14 },  
#       "name":"San Francisco International Airport",  
#       "country":"United States",  
#       "country attrs":{  
#         "type":"Country",  
#         "code":"US" },  
#       "admin1":"California",  
#       "admin1 attrs":{  
#         "type":"State",  
#         "code":"US-CA" },  
#       "admin2":"San Mateo",  
#       "admin2 attrs":{  
#         "type":"County",  
#         "code":"" },  
#       "admin3":"",  
#       "locality1":"Millbrae",  
#       "locality1 attrs":{  
#         "type":"Town" },  
#       "locality2":"",  
#       "postal":"94128",  
#       "postal attrs":{  
#         "type":"Zip Code" },  
#       "centroid":{  
#         "latitude":37.614712,  
#         "longitude":-122.391808 },  
#       "boundingBox":{  
#         "southWest":{  
#           "latitude":37.601822,  
#           "longitude":-122.408089 },  
#         "northEast":{  
#         "latitude":37.627602,  
#         "longitude":-122.375526 } },  
#       "uri":"http:\/\/where.yahooapis.com\/v1\/place\/12521721",  
#       "lang":"en-us" } ],  
#   "start":0,  
#   "count":1,  
#   "total":1 } }       
*/

Basic Object

public class YahooPlace
{
    public string woeid
    {
        get { return this._woeid; }
        set { this._woeid = value; }
    }
    public string placeTypeName
    {
        get { return this._placeTypeName; }
        set { this._placeTypeName = value; }
    }
    public string placeTypeName_attrs
    {
        get { return this._placeTypeName_attrs; }
        set { this._placeTypeName_attrs = value; }
    }
    public string country
    {
        get { return this._country; }
        set { this._country = value; }
    }
    public string country_attrs
    {
        get { return this._country_attrs; }
        set { this._country_attrs = value; }
    }
    public string admin1
    开发者_StackOverflow中文版{
        get { return this._admin1; }
        set { this._admin1 = value; }
    }
    public string admin1_attrs
    {
        get { return this._admin1_attrs; }
        set { this._admin1_attrs = value; }
    }
    public string admin2
    {
        get { return this._countryCode; }
        set { this._countryCode = value; }
    }
    public string admin2_attrs
    {
        get { return this._admin2_attrs; }
        set { this._admin2_attrs = value; }
    }
    public string admin3
    {
        get { return this._admin3; }
        set { this._admin3 = value; }
    }
    public string locality1
    {
        get { return this._locality1; }
        set { this._locality1 = value; }
    }
    public string locality1_attrs
    {
        get { return this._locality1_attrs; }
        set { this._locality1_attrs = value; }
    }
    public string locality2
    {
        get { return this._locality2; }
        set { this._locality2 = value; }
    }
    public string postal
    {
        get { return this._postal; }
        set { this._postal = value; }
    }
    public string postal_attrs
    {
        get { return this._postal_attrs; }
        set { this._postal_attrs = value; }
    }
    public string centroid
    {
        get { return this._centroid; }
        set { this._centroid = value; }
    }
    public string boundingBox
    {
        get { return this._boundingBox; }
        set { this._boundingBox = value; }
    }
    public string uri
    {
        get { return this._uri; }
        set { this._uri = value; }
    }
    public string lang
    {
        get { return this._lang; }
        set { this._lang = value; }
    }

    private string _admin1_attrs,_admin2_attrs, _admin3, _locality1, _locality1_attrs, _locality2, _postal, _postal_attrs, _centroid, _lang, _uri, _boundingBox, _countryCode, _admin1, _country_attrs, _country, _placeTypeName_attrs, _placeTypeName, _woeid;

}


It's returning a collection of place are you accounting for that? Also you might try something like this and see what it generates. http://jsonclassgenerator.codeplex.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜