# Reading "hubspotDefined": true in Python

**URL:** <https://community.hubspot.com/t/reading-hubspotdefined-true-in-python/56395>\
**Category:** APIs & Integrations\
**Tags:** python\
**Created:** [May 6, 2022, 2:23pm UTC](https://community.hubspot.com/t/reading-hubspotdefined-true-in-python/56395 "2022-05-06T14:23:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![klloyd\_1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/klloyd_1/32/28881_2.png) [@klloyd\_1](https://community.hubspot.com/u/klloyd_1)\
**Post date:** [May 6, 2022, 2:23pm UTC](https://community.hubspot.com/t/reading-hubspotdefined-true-in-python/56395/1 "2022-05-06T14:23:29Z")

</div>

Hello friends,

I’m working on a Python script that will read object properties, and needs to determine whether or not a property is one of the default properties created by HubSpot. I’m running into issues in Python determining whether the “hubspotDefined” value is True. JSON returns as “true”, whereas Python looks for “True”. I’ve read some articles on other sites but was hoping that someone has already done this particular excersise on the values returned by HubSpot’s properties API.

Example of one of the properties returned in read all properties API:

```lia-code-sample
 {
 "updatedAt": "2019-09-23T17:45:44.354Z",
 "createdAt": "2019-08-06T02:41:10.544Z",
 "name": "hs_searchable_calculated_international_mobile_number",
 "label": "Calculated Mobile Number with country code",
 "type": "phone_number",
 "fieldType": "phonenumber",
 "description": "Mobile number with country code",
 "groupName": "contactinformation",
 "options": [],
 "displayOrder": -1,
 "calculated": true,
 "externalOptions": false,
 "hasUniqueValue": false,
 "hidden": true,
 "hubspotDefined": true,
 "modificationMetadata": {
 "archivable": true,
 "readOnlyDefinition": true,
 "readOnlyValue": true
 },
 "formField": false
 }

```

A short section of the Python code I’m using:

```lia-code-sample
from_contact_properties_response = requests.request("GET", from_contact_properties_url, headers=from_contact_properties_headers, data=from_contact_properties_payload)
from_contact_properties_data = from_contact_properties_response.json()
from_contact_properties = from_contact_properties_data['results']
to_contact_properties_inputs = []
for i in from_contact_properties:
 if i["hubspotDefined"] == True:
 print(i)
 else:
 to_contact_properties_inputs.append(i)

```

The overall response to json approach is something I’ve used many times before, and works fine for reading if the “name” key contains certain text, if the “fieldType” is equal to a certain value, etc. First time trying to use logic based on the boolean fields though, and this is giving issues. I’m hoping that I don’t have to completely redo how I’ve been making calls and retrieving and reading requests, but if necessary I will make those adjustments.  
Thank you!

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [May 6, 2022, 6:33pm UTC](https://community.hubspot.com/t/reading-hubspotdefined-true-in-python/56395/2 "2022-05-06T18:33:20Z")

</div>

Hey, [@klloyd\_\_1](https://community.hubspot.com/t5/user/viewprofilepage/user-id/381293) thanks for reaching out. I appreciate you including all those details and context.

@taran42 do you have any insight into how [@klloyd\_\_1](https://community.hubspot.com/t5/user/viewprofilepage/user-id/381293) might approach this situation?

Thank you 🙌 – Jaycee

---

<div class="post-metadata">

**Author:** ![taran42](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/taran42/32/105524_2.png) [@taran42](https://community.hubspot.com/u/taran42)\
**Post date:** [May 6, 2022, 7:08pm UTC](https://community.hubspot.com/t/reading-hubspotdefined-true-in-python/56395/3 "2022-05-06T19:08:17Z")

</div>

[@klloyd\_\_1](https://community.hubspot.com/t5/user/viewprofilepage/user-id/381293) I’m not 100%, but maybe it’s case sensitive?

Something else is that you could search your JSON code for the “hubspotDefined” string and then search for the value of “true” or “false.”

---

<div class="post-metadata">

**Author:** ![klloyd\_1](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/klloyd_1/32/28881_2.png) [@klloyd\_1](https://community.hubspot.com/u/klloyd_1)\
**Post date:** [May 9, 2022, 12:59pm UTC](https://community.hubspot.com/t/reading-hubspotdefined-true-in-python/56395/4 "2022-05-09T12:59:44Z")

</div>

@Tara boom, that worked! updated the code to:

```lia-code-sample
if '"hubspotDefined: true"' in i:
 print(i)

```

as you suggested, rather than testing against the boolean value of that key, it’s simply checking to see if that entire string exists within i. This will work for what I’m looking to accomplish, thank you again!
