Create JSON without keys with empty values

  1. I’m collecting data from a Google Spreadsheet and converting it into a JSON object.
  2. I’m then sending this JSON object to an API call to a web service.
  3. The issue is, the web service is stupid and doesn’t accept specific JSON keys if their value is different than true. So if let’s say we have a JSON key called enabled, I must choose to either send {"enabled": true}, or simply omit the key enabled.

I can imagine only 2 ways to do this:

  1. Like I did, create a pre-defined JSON object with all keys, then once it’s populated with all values - remove the keys that have empty values.
  2. Create the JSON object “on-the-fly” (not with pre-defined keys), which I’m not sure how to do and if it’s possible.

That’s what the ignore keyword does.

Original

Screenshot_2024-01-11_160153

With ignore

Screenshot_2024-01-11_160100

Output (empty JSON because everything is null)

Screenshot_2024-01-11_160109


Links

Here are some useful links and guides to help you get started and learn more on how to use the Make platform, apps, and app modules —

General

Help Center Basics

Articles & Videos

4 Likes

Wow, didn’t know that existed… thanks so much!

2 Likes