using System.Collections.Generic;
using Newtonsoft.Json.Linq;
public static void Main()
""candidateId"": ""e8dc40c5-abff-eb11-94ef-000d3a339ed8"",
""candidateName"": ""Christabelle Dingcong"",
""dateOfBirth"": ""1983-10-27T00:00:00Z"",
""email"": ""carabuene@gmail.com"",
""mobilePhone"": ""(416) 831 - 7388"",
""contactSsn"": ""730763906"",
""birthDate"": ""1983-10-27T00:00:00Z"",
var obj = JObject.Parse(json);
var dataObj = (JObject)obj.Property("data").Value;
var profileContext = (JObject)dataObj.Property("ProfileContext").Value;
if (profileContext.ContainsKey("contactSsn")) {
var ssn = profileContext.Property("contactSsn");
Console.WriteLine($"SSN: {ssn.Value}");
Console.WriteLine("No SSN");
var output = JsonConvert.SerializeObject(obj);
Console.WriteLine(output);