08-16-2023 12:23 AM
Hi team,
There are few fields where I'm having value as NULL, I want to make NULL in to blank, in all the Fields where I have the NULL. Help me in a way so that I can write a logic which can replace all the NULL in to Blank.
Thanks in Advance.
Solved! Go to Solution.
08-16-2023 12:59 AM
Hi @Manzoor ,
Depending on your input data, if you have a flat object, you can make all of the NULL fields blank by using the following expression:
$.mapValues(val => val == null ? "" : val)
This will iterate over each value for each key in the input data and depending if the value is null, it will return an empty string otherwise it will return the original value.
Input data sample:
[
{
"msg": "Hello, World",
"num": 1,
"field2": null
}
]
Output:
[
{
"msg": "Hello, World",
"num": 1,
"field2": ""
}
]
08-16-2023 12:59 AM
Hi @Manzoor ,
Depending on your input data, if you have a flat object, you can make all of the NULL fields blank by using the following expression:
$.mapValues(val => val == null ? "" : val)
This will iterate over each value for each key in the input data and depending if the value is null, it will return an empty string otherwise it will return the original value.
Input data sample:
[
{
"msg": "Hello, World",
"num": 1,
"field2": null
}
]
Output:
[
{
"msg": "Hello, World",
"num": 1,
"field2": ""
}
]
08-16-2023 01:06 AM
Thanks @j_angelevski