Help with error in deserialization?????

Jan 5, 2009 at 11:06 PM
This is my responce from Myspace


This is my Class

 public class Person
        public string fname { get; set; }
        public string mname { get; set; }
        public string lname { get; set; }

        #region MySpace Properties
        public string name { get; set; }
        public string displayName { get; set; }
        public string familyName { get; set; }
        public string givenName { get; set; }
        public string nickName { get; set; }
        public string id { get; set; }
        public string hasApp { get; set; }
        public string[] emails { get; set; }
        public DateTime dateOfBirth { get; set; }
        public int age { get; set; }

        public static Person getjson(OAuth.Net.Consumer.OAuthResponse response)
            StreamReader irr = new StreamReader(response.ProtectedResource.GetResponseStream());
            string body = irr.ReadToEnd();

            Person deserializedPerson = (Person)JavaScriptConvert.DeserializeObject(body, typeof(Person));
            return deserializedPerson;


This is my error..

Could not find member 'entry' on object of type 'RuntimeType'

Description: Anunhandled exception occurred during the execution of the current webrequest. Please review the stack trace for more information about theerror and where it originated in the code.

Exception Details: Newtonsoft.Json.JsonSerializationException: Could not find member 'entry' on object of type 'RuntimeType'

Source Error:

Line 518:      {Line 519:        if (_missingMemberHandling == MissingMemberHandling.Error)Line 520:          throw new JsonSerializationException("Could not find member '{0}' on object of type '{1}'".FormatWith(CultureInfo.InvariantCulture, memberName, targetType.GetType().Name));Line 521:      }Line 522:    }

Source File: J:\SocialCelebrityNet\Json\Src\Newtonsoft.Json\JsonSerializer.cs    Line: 520

Help please i would like to deserialize only the entry section into the person object.

Jan 6, 2009 at 7:08 AM
Load the JSON into a JObject, get the piece of JSON you want, create a reader from it and pass it to the serializer.