Click here to Skip to main content
15,897,519 members
Home / Discussions / C#
   

C#

 
AnswerRe: change the exe application icon on runtime Pin
OriginalGriff19-Apr-15 22:03
mveOriginalGriff19-Apr-15 22:03 
QuestionRotate an object Pin
Isawyouoo19-Apr-15 15:00
Isawyouoo19-Apr-15 15:00 
AnswerRe: Rotate an object Pin
Sascha Lefèvre19-Apr-15 15:31
professionalSascha Lefèvre19-Apr-15 15:31 
GeneralRe: Rotate an object Pin
Isawyouoo19-Apr-15 15:54
Isawyouoo19-Apr-15 15:54 
GeneralRe: Rotate an object Pin
Sascha Lefèvre19-Apr-15 16:00
professionalSascha Lefèvre19-Apr-15 16:00 
QuestionNeed to parse the XML data Windows store app C# Pin
Hari-CodeBlogger19-Apr-15 14:15
Hari-CodeBlogger19-Apr-15 14:15 
AnswerRe: Need to parse the XML data Windows store app C# Pin
PIEBALDconsult19-Apr-15 14:53
mvePIEBALDconsult19-Apr-15 14:53 
QuestionRetrieving email value from a JSON string \ object. Pin
Doncal19-Apr-15 12:52
Doncal19-Apr-15 12:52 
Hi Guys,

Im having some trouble with JSON.
I need to retrieve the email value of each of a list of contacts, but am unable to do so.
C#
string json = @"
{
  'contacts': [
    {
      'vid': 154835,
      'properties': {
        'firstname': {
          'value': 'HubSpot'
        },
        'lastname': {
          'value': 'Test'
        }
      },
      'identity-profiles': [
        {
          'vid': 154835,
          'saved-at-timestamp': 1405347851237,
          'deleted-changed-timestamp': 0,
          'identities': [
            {
              'type': 'EMAIL',
              'value': 'test@hubspot.com',
              'timestamp': 1405347851180
            },
            {
              'type': 'LEAD_GUID',
              'value': 'c8f20860-d3d6-4b57-b092-86a07cebdcbc',
              'timestamp': 1405347851237
            }
          ]
        }
      ],
      'merge-audits': []
    }
  ],
  'has-more': true,
  'vid-offset': 196189
}";

Above is one contact from a list of contacts.
Below is the code Im using to retrieve the required data.
Im able to retrieve firstname and lastname, but am unable to retrieve email.

Any suggestions as to how I can go about retrieving the email value?
C#
dynamic data = JObject.Parse(strReader);

var vContacts = from i in (IEnumerable<dynamic>)data.contacts
                select new
                {
                  vid = i.vid,
                  firstname = i.properties.firstname.value,
                  lastname = i.properties.lastname.value,
                  email = (string)i.SelectToken("identity-profiles.identities.value")
                };

Any help would be appreciated.
AnswerRe: Retrieving email value from a JSON string \ object. Pin
Sascha Lefèvre19-Apr-15 15:51
professionalSascha Lefèvre19-Apr-15 15:51 
AnswerRe: Retrieving email value from a JSON string \ object. Pin
Doncal19-Apr-15 20:06
Doncal19-Apr-15 20:06 
GeneralRe: Retrieving email value from a JSON string \ object. Pin
Sascha Lefèvre19-Apr-15 21:56
professionalSascha Lefèvre19-Apr-15 21:56 
GeneralRe: Retrieving email value from a JSON string \ object. Pin
Mycroft Holmes19-Apr-15 23:02
professionalMycroft Holmes19-Apr-15 23:02 
GeneralRe: Retrieving email value from a JSON string \ object. Pin
Doncal19-Apr-15 23:40
Doncal19-Apr-15 23:40 
GeneralRe: Retrieving email value from a JSON string \ object. Pin
Sascha Lefèvre20-Apr-15 6:34
professionalSascha Lefèvre20-Apr-15 6:34 
QuestionC# timesheet business logic question Pin
Member 1162043719-Apr-15 12:21
Member 1162043719-Apr-15 12:21 
AnswerRe: C# timesheet business logic question Pin
Sascha Lefèvre19-Apr-15 12:25
professionalSascha Lefèvre19-Apr-15 12:25 
QuestionHow do I add 3 objects to array in C# Pin
Aindriu Mac Giolla Eoin19-Apr-15 8:27
Aindriu Mac Giolla Eoin19-Apr-15 8:27 
AnswerRe: How do I add 3 objects to array in C# Pin
Sascha Lefèvre19-Apr-15 8:31
professionalSascha Lefèvre19-Apr-15 8:31 
GeneralRe: How do I add 3 objects to array in C# Pin
Aindriu Mac Giolla Eoin19-Apr-15 8:33
Aindriu Mac Giolla Eoin19-Apr-15 8:33 
GeneralRe: How do I add 3 objects to array in C# Pin
Sascha Lefèvre19-Apr-15 8:38
professionalSascha Lefèvre19-Apr-15 8:38 
GeneralRe: How do I add 3 objects to array in C# Pin
Aindriu Mac Giolla Eoin19-Apr-15 8:44
Aindriu Mac Giolla Eoin19-Apr-15 8:44 
GeneralRe: How do I add 3 objects to array in C# Pin
PIEBALDconsult19-Apr-15 9:01
mvePIEBALDconsult19-Apr-15 9:01 
GeneralRe: How do I add 3 objects to array in C# Pin
Sascha Lefèvre19-Apr-15 9:03
professionalSascha Lefèvre19-Apr-15 9:03 
GeneralRe: How do I add 3 objects to array in C# Pin
Aindriu Mac Giolla Eoin19-Apr-15 9:13
Aindriu Mac Giolla Eoin19-Apr-15 9:13 
GeneralRe: How do I add 3 objects to array in C# Pin
Sascha Lefèvre19-Apr-15 9:16
professionalSascha Lefèvre19-Apr-15 9:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.