Ask Your Question

Is there any way to prevent null fields from being returned in OData responses?

asked 2023-01-16 12:19:39 -0600

updated 2023-01-19 09:25:02 -0600

As with many rets/reso feeds we get a significant number of null field values (and empty lists/arrays) in API responses. We'd like to know if there is a parameter that we can send to suppress those values and make the response payloads smaller and cleaner?

Eg. this record would be about 1/20th the size with nulls/empties excluded:

        "@odata.context": "$metadata#Property",
        "": "'642b40d1c4f4da1d3a7fc200fe1be61f')",
        "City": "Kahului",
        "Roof": [],
        "View": [
        "Sewer": [],
        "Levels": [],
        "ViewYN": true,
        "Zoning": null,
        "Cooling": [],
        "Country": "US",
        "Fencing": [],
        "Heating": [],
        "Stories": 0,
        "TaxYear": null,
        "Basement": [],
        "Electric": [],
        "Flooring": [],
        "GarageYN": null,
        "Latitude": 20.817051,
        "CarportYN": null,
        "CloseDate": null,
        "CoolingYN": false,
        "Furnished": null,
        "HeatingYN": null,
        "LeaseTerm": null,
        "ListPrice": 475000,
        "ListingId": "385101",
        "Longitude": -156.454092,
        "MlsStatus": "CANCELED",
        "OwnerPays": [],
        "Utilities": [],
        "YearBuilt": null,
        "Appliances": [],
        "ClosePrice": null,
        "CurrentUse": [],
        "HighSchool": null,
        "Inclusions": null,
        "ListingKey": "642b40d1c4f4da1d3a7fc200fe1be61f",
        "LivingArea": null,
        "Possession": [],
        "PostalCode": "96732",
        "StreetName": "Nopu",
        "Topography": null,
        "UnitNumber": "6",
        "BK1_LA1_Zip": "96732-2315",
        "BK1_LA2_Zip": null,
        "BK1_L_DOMLS": 987,
        "BK1_SA1_Zip": null,
        "BK1_SA2_Zip": null,
        "Concessions": null,
        "Disclosures": [],
        "FireplaceYN": null,
        "GrossIncome": null,
        "LockBoxType": [],
        "LotFeatures": [],
        "LotSizeArea": 0.362,
        "PetsAllowed": [],
        "PhotosCount": 1,
        "PossibleUse": [],
        "SpaFeatures": [],
        "SyndicateTo": [
        "WaterSource": [],
        "BK1_LA1_City": "Kahului",
        "BK1_LA2_City": null,
        "BK1_LM_Dec_2": null,
        "BK1_LM_Dec_4": null,
        "BK1_LM_Dec_7": null,
        "BK1_LM_Dec_8": null,
        "BK1_LM_Dec_9": null,
        "BK1_SA1_City": null,
        "BK1_SA2_City": null,
        "BuildingName": "Pulehunui",
        "BusinessName": null,
        "BusinessType": [
        "DaysOnMarket": 987,
        "GarageSpaces": null,
        "ListAgentFax": null,
        "ListAgentKey": "54704e82b6dd33b7dee7b5ac45975d2a",
        "ListAgentURL": null,
        "ListPriceLow": 475000,
        "ListingTerms": [],
        "LotSizeAcres": 0.362,
        "LotSizeUnits": "Acres",
        "MLSAreaMajor": "Kahului",
        "NumberOfLots": null,


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-01-23 17:53:29 -0600

We don't currently have that option but that is a good suggestion.

edit flag offensive delete link more


Hey bwolven thank you for the response. Just for reference this concept is part of the OData v4 specification which allows for a Preferences request header with "omit-values=null". Sending this request header indicates to the server that null values should not be included in responses.

Organ_re12 gravatar imageOrgan_re12 ( 2023-01-27 10:05:50 -0600 )edit

Hi Organ. The omit-values preference is included in the 4.01 standard. We're currently compliant with OData v4.0 which does not include this preference. You're options are odata.allow-entityreferences, odata.callback, odata.continue-on-error, odata.include-annotations, odata.maxpagesize, odata.track-changes, return=representation/minimal, respond-async, and wait

Joe Brueske gravatar imageJoe Brueske ( 2023-01-27 10:23:03 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2023-01-16 12:19:39 -0600

Seen: 18 times

Last updated: Jan 23