using System.Collections.Generic;
using Newtonsoft.Json.Linq;
private const string jsonString = """
"IsPreferredAddress": true,
"Address": "test4@hailr.app",
"Id": "e412c3a6-4e7a-464f-bf86-d85150850623"
"CustomerId": "00000000-0000-0000-0000-000000000000",
"CountryId": "40effeb2-deca-4669-b4e0-d8c5b9bee33d",
"Code": "99070000263165679",
"IsThirdPartyMarketingAllowed": true,
"IsMarketingAllowed": true,
"IsCustomerBlocked": false,
"IsRegisteredForLoyalty": true,
"Name": "Johannes Hailr",
"IsSchoolDaysAllowed": false
"IdentificationTypeId": "e3878eb1-5d68-4976-b6bd-e13f6c6efa9e",
"Id": "e3878eb1-5d68-4976-b6bd-e13f6c6efa9e",
"IdentificationValue": "7612245041087",
"DateOfBirth": "1976-12-24T00:00:00+00:00",
"CountryId": "40effeb2-deca-4669-b4e0-d8c5b9bee33d",
"Id": "40effeb2-deca-4669-b4e0-d8c5b9bee33d",
"Id": "00000000-0000-0000-0000-000000000000",
"Id": "39ad2319-ff85-43bf-b1a2-0e19bbaf9d59",
"IsPreferredContactNumber": true,
"Name": "Johannes Hailr",
"Id": "00000000-0000-0000-0000-000000000000",
private const string IsSuccessJsonPath = "IsSuccess";
private const string ResultMapJson = """
"Customer Code": "Customer.Code",
"Identifier Type": "Customer.Person.IdentificationTypeId",
"Identifier Number": "Customer.Person.IdentificationValue",
"First Name": "Customer.Person.Name",
"Last Name": "Customer.Person.LastName",
"Date Of Birth": "Customer.Person.DateOfBirth",
"Gender": "Customer.Person.Gender",
"Email Address": "Customer.EmailAddress[0].Address",
"Phone Country Code": "Customer.ContactNumber[0].DialingCode",
"Phone Number": "Customer.ContactNumber[0].Number",
"Allow Marketing": "Customer.Option.IsMarketingAllowed",
"Allow Third Party Marketing": "Customer.Option.IsThirdPartyMarketingAllowed",
"Register For Rewards": "Customer.Option.IsRegisteredForLoyalty"
public static void Main()
JObject json = JObject.Parse(jsonString);
var isSuccess = (bool)json.SelectToken(IsSuccessJsonPath);
var resultMap = JsonConvert.DeserializeObject<Dictionary<string, string>>(ResultMapJson);
var values = new Dictionary<string, object>();
foreach (var resultMapItem in resultMap)
var keyValue = json.SelectToken(resultMapItem.Value);
values.Add(resultMapItem.Key, keyValue.ToObject(keyValue.Type));
foreach (var keyValue in values)
Console.WriteLine($"{keyValue.Key}: {keyValue.Value}");
Console.WriteLine("Nope.");