Fetch only keys from JSON Object using groovy

Viewed 10489

This is my JSON Object

{
"master": {
   "node": "xyz", 
   "files": [{"type": "modified", "file": "test.txt"}]
   }, 
"testbranch2": {
   "node": "abc", 
   "files": [{"type": "modified", "file": "test.txt"}] 
   }, 
"testbranch": {
   "node": "xxx", 
   "files": [{"type": "modified", "file": "test.txt"}], 
   }
}

I need only the object key names, like "master", "testbranch2","testbranch. How do I fetch only the object key names using groovy?

1 Answers
Related