Hello,
I have this json input, and some values might be empty. How can I filter the json so it only contains values that are not empty?
{
"job_position_id": 34534,
"first_name": "dfd",
"last_name": "dfd",
"email": "dfdf",
"recruiting_channel_id": 34343,
"application_date": "01.01.2023",
"phase": {
"type": "system",
"id": "343"
},
"files": null,
"attributes": [
{
"id": "custom_attribute_3577048",
"value": "dfdf"
},
{
"id": "custom_attribute_3577049",
"value": "dff"
},
{
"id": "custom_attribute_3569071",
"value": "01.01.2034"
},
{
"id": "custom_attribute_3569072",
"value": "dfdf"
},
{
"id": "custom_attribute_3569073",
"value": "01.01.2034"
},
{
"id": "custom_attribute_3569074",
"value": "23232dff"
}
]
}
thanks in advance.
Best
Masa
Welcome to the Make community!
What do you mean by “some values might be empty”?
Hey @samliew,
like for example this value might be null or just empty
"recruiting_channel_id": null,
or
"recruiting_channel_id": ,
In this case I don’t want it to appear in the JSON input so I want to filter it out.
I tried to do that with an if-statement but it is not very helpful becaue some commas might be too much or some might be missing so I was looking for antoher solution.
Welcome to the Make community!
You can use a Text Parser “Replace” module with this Pattern (regular expression):
\s*"[\w_]+": (?:null|""|\[\s*\]),?(?=\n)
Proof https://regex101.com/r/pgXhtB
Important Info
Global match must be set to YES!
For more information, see the Text Parser page in the Make Help Center:
Match Pattern
The Match pattern module enables you to find and extract string elements matching a search pattern from a given text. The search pattern is a regular expression, which is a sequence of characters in which each character is either a metacharacter, having a special meaning, or a regular character that has a literal meaning.
Hope this helps! Let me know if there are any further questions or issues.
— @samliew
P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.
@samliew
Thanks a lot for you answer.
I tried it that way, but it didn’t work:
Did I do everything correct?
Your pattern did not follow the exact pattern I provided above.
You need to put the special variable emptystring in the replace field.
Hope this helps! Let me know if there are any further questions or issues.
— @samliew
@samliew, Thank you so much!
Now, I have an issue with the structure of the file
value. How can I remove empty arrays inside it?
No problem, glad I could help!
1. If anyone has a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.
2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.
This marks the topic as solved, so that:
- others can save time when catching up with the latest activity here, and
- allows others to quickly jump to the solution if they come across the same problem
To do this, simply click the checkbox at the bottom of the post that answers your question:

3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!
Hope this helps! Let me know if there are any further questions or issues.
— @samliew
P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.