# Deserialization of JSON

**URL:** <https://community.hubspot.com/t/deserialization-of-json/33859>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [March 15, 2021, 9:21am UTC](https://community.hubspot.com/t/deserialization-of-json/33859 "2021-03-15T09:21:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZZaim](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/zzaim/32/25572_2.png) [@ZZaim](https://community.hubspot.com/u/ZZaim)\
**Post date:** [March 15, 2021, 9:21am UTC](https://community.hubspot.com/t/deserialization-of-json/33859/1 "2021-03-15T09:21:10Z")

</div>

Hello Team!  
I am working on an integeration between HubSpot and Navsion, to forward contacts from HubSpot to Navison (Dynamics).  
I where to get the contacts from HubSpot contacts API as a String.  
I want to deserialize this string to a JSON object in c#.

I where not able to find what data types are the elements.

My Question:  
Is there c# Class for Contacts to see what data types are the elements? How is the class structured?

Any support is appriciated 🙂

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [March 15, 2021, 6:39pm UTC](https://community.hubspot.com/t/deserialization-of-json/33859/2 "2021-03-15T18:39:05Z")

</div>

Hi @ZZaim

Throwing some c# folks in here 😀

@JokersWild , @gotmike ,@odowdbrendan can you all help here?

---

<div class="post-metadata">

**Author:** ![ZZaim](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/zzaim/32/25572_2.png) [@ZZaim](https://community.hubspot.com/u/ZZaim)\
**Post date:** [March 15, 2021, 8:09pm UTC](https://community.hubspot.com/t/deserialization-of-json/33859/3 "2021-03-15T20:09:08Z")

</div>

Hey @dennisedson!  
I was able to find a solution for this problem.  
This is The Solution, it might help other intrested people.  
I am basicly calling the HubSpot contacts API with an HTTP Client and recieving the contacts as a string. I deserialized the JSON Object to access the diffrent elements and properties.  
c# Code:

```lia-code-sample
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace HubSpot_API
{
class Program
{
HttpClient client = new HttpClient();

static async Task Main(string[] args)
{
Program program = new Program();
await program.GetContacts();
}

private async Task GetContacts()
{
string response = await client.GetStringAsync("https://api.hubapi.com/crm/v3/objects/contacts/?limit=6&archived=false&hapikey="Your API Key"&properties=salutation&properties=email&properties=firstname&properties=lastname&properties=phone_no&properties=country_region_code&properties=position&properties=address");
//Console.WriteLine(response);
var rootObj = JsonConvert.DeserializeObject<Root>(response);
{
foreach (var element in rootObj.results)
{
Console.WriteLine(element.id);

}
}

}

}

public class Properties
{
public string address { get; set; }
public string country_region_code { get; set; }
public DateTime createdate { get; set; }
public string email { get; set; }
public string firstname { get; set; }
public string hs_object_id { get; set; }
public DateTime lastmodifieddate { get; set; }
public string lastname { get; set; }
public string phone_no { get; set; }
public string position { get; set; }
public string salutation { get; set; }
}

public class Result
{
public string id { get; set; }
public Properties properties { get; set; }
public DateTime createdAt { get; set; }
public DateTime updatedAt { get; set; }
public bool archived { get; set; }
}

public class Root
{
public List<Result> results { get; set; }
}

}

```
