web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to delete key valu...
Power Automate
Answered

How to delete key values ​​that are equal to null values?

(0) ShareShare
ReportReport
Posted on by 21
I have a question, about how to keep json key values ​​that are different from Null. Or how to delete key values ​​that are equal to null values.

This JSON comes from the output of a Get Details action from a Forms response. The name of the key values ​​(form questions) comes in a random way, similar to an ID, making it difficult to understand what type of question.
 
For example, "rdf91e03331b94fbb9c2f32308f0cd89a" is equivalent to the question "Supplier".

Furthermore, it is possible that several answers will be empty, as not all of them are mandatory. For this reason, I would like to remove items with empty values ​​from my json body.
 
Here is an example of json output:
 
"body": {
        "responder": "anonymous",
        "submitDate": "2/26/2025 8:50:27 PM",
        "r57663d98c7c04fe1aae2fe11fedec283": "X",
        "r7068cd8db54c4d0cbf9f1c451c40ae4a": "X",
        "rbe24791ec0154a5c8d66baa1be660975": "",
        "re14f03af60504c01b57cce674af696cd": "X",
        "rc09a3080f25f44ff97699117b871249d": " x",
        "rdf91e03331b94fbb9c2f32308f0cd89a": "x",
        "r81059cc1542447bf91982495e5ff9cfb": "",
        "rd3d5cd4f2b504292ab566132a28db88e": "X",
        "r78a264d23bc84ccf981ff6f096b8a168": "",
        "rec10361cf15d461685127414281912bf": "x",
        "rb5bad15fda8842a78a2329178a8b3f6f": "X",
        "r4f09fd8879f14373987e07668dd8086a": "x",
        "r8cb9bcb77c244fea9e7e27d9ee85aff5": "",
        "r15e93145309a4b428c7b7ea2175a8c92": "",
        "r0c3495b4213040aab5384f08aa73480b": "x",
        "rb599c2e4022a4bf086e4a956f9b0109c": "",
        "r1f189eb2c0e3499e8cec6d524b09dc5f": "",
        "r83f2b93591f64a77a074e580bd4eb353": "",
        "r4dc795fd60f942efbf8e452d275a0fda": "x",
        "r0f1ce6494cca485292bff64d16ee849c": "",
        "rcc06a33ec9f04441909800c7f2ccc8ce": "",
        "r2fefc10ac3c145b6a84e758964154c03": "",
        "r82ab19e3c49749878be86ba36cc48f97": "",
        "r2c9e1d75847b4fee98f03bc51a265f61": "",
        "r4eb459f854ce4bcc9ae2b976d150ae7b": "",
        "r06c436a98c884daeb35c7b1001654d77": "",
        "r8d2ef6ce89f946a69fed430ac7e725e4": "",
        "r72613dd0cb77446482b3fc30a2513741": ""
    }
 
And here, the results I've expect:
 
"body": {
        "responder": "anonymous",
        "submitDate": "2/26/2025 8:50:27 PM",
        "r57663d98c7c04fe1aae2fe11fedec283": "X",
        "r7068cd8db54c4d0cbf9f1c451c40ae4a": "X",
        "re14f03af60504c01b57cce674af696cd": "X",
        "rc09a3080f25f44ff97699117b871249d": " x",
        "rdf91e03331b94fbb9c2f32308f0cd89a": "x",
        "rd3d5cd4f2b504292ab566132a28db88e": "X",
        "rec10361cf15d461685127414281912bf": "x",
        "rb5bad15fda8842a78a2329178a8b3f6f": "X",
        "r4f09fd8879f14373987e07668dd8086a": "x",
        "r0c3495b4213040aab5384f08aa73480b": "x",
        "r4dc795fd60f942efbf8e452d275a0fda": "x"
 
    }
 
Bonus Challenge:
It is possible for new questions to be created, and it would be incredible to find a dynamic way to resolve this, without having to "map" the name of the question.
 
That is, read all key-values ​​from a json, and remove all keys that contain empty values
Categories:
I have the same question (0)
  • VictorIvanidze Profile Picture
    13,073 on at
  • renanfm Profile Picture
    21 on at
     
    Thanks for the answer, but this method requires inputting the name of the key values ​​(Form Question), but in my case, these names are completely insane.
     
    That's why I'm looking for some automatic method to do this. In other words, identify within a json, which key values ​​has empty items and then delete it.
  • Verified answer
    VictorIvanidze Profile Picture
    13,073 on at
    Here you are:
     
  • VictorIvanidze Profile Picture
    13,073 on at
    I'd like to say that more elegant solution was provided by 
    Expiscornovus here:
     
     
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard