APIs & Integrations

stephenhall
Member

Batch Properties for Contacts - read JSON into C#

SOLVE

i am using C# to call this https://api.hubapi.com/contacts/v1/contact/vids/batch/?vid=xxx&vid=yyy&vid=zzz&hapikey=Mykey
can someone help me iterate the JSON that comes back so i can extract all the Properties name and value for each VID ?

I can get the JSON data into C# using this syntax

       var httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
       httpWebRequest.ContentType = "application/json";
       httpWebRequest.Method = "GET";
       var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();

but i cant work out the code needed iterate the object and obtain All the property name and value pairs for each VID

0 Upvotes
1 Accepted solution
cbarley
Solution
HubSpot Alumni
HubSpot Alumni

Batch Properties for Contacts - read JSON into C#

SOLVE

Hi @stephenhall, I won't be able to help with the programming side as I don't know much about C#. A forum dedicated to that language might be a good place to turn to if you're stuck. That said, looks like C# has a forEach function that you can use to iterate through an object or array to grab the values from as per this stackoverflow article: https://stackoverflow.com/questions/10315073/how-to-get-property-name-and-its-value

View solution in original post

0 Upvotes
2 Replies 2
cbarley
Solution
HubSpot Alumni
HubSpot Alumni

Batch Properties for Contacts - read JSON into C#

SOLVE

Hi @stephenhall, I won't be able to help with the programming side as I don't know much about C#. A forum dedicated to that language might be a good place to turn to if you're stuck. That said, looks like C# has a forEach function that you can use to iterate through an object or array to grab the values from as per this stackoverflow article: https://stackoverflow.com/questions/10315073/how-to-get-property-name-and-its-value

0 Upvotes
stephenhall
Member

Batch Properties for Contacts - read JSON into C#

SOLVE

Thank you for the reply. yes i have solved it by iterating through the nested JSON to get its child and grandchild properties.

This issue is now solved.

0 Upvotes