I will show you a firm way to traverse an object tree derived from a JSON. It works but isn’t fancy like GUI tools.
Create a Test Case, copy & paste the following code:
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
String json = """
{
"data": {
"owner": "I my me mine",
"address": "somewhere",
"accountDetails": [
{ "foo": "foo value", "balance": 123 },
{ "bar": "bar value", "balance": 456 },
{ "buz": "buz value", "balance": 789},
{ "type": "Savings", "balance": 5000.00 }
]
}
}
"""
def slurper = new JsonSlurper()
def parsed = slurper.parseText(json)
//def item = parsed
//def item = parsed["data"]
//def item = parsed["data"]["owner"]
//def item = parsed["data"]["accountDetails"]
//def item = parsed["data"]["accountDetails"][0]
//def item = parsed["data"]["accountDetails"][1]
//def item = parsed["data"]["accountDetails"][2]
//def item = parsed["data"]["accountDetails"][3]
//def item = parsed["data"]["accountDetails"][3]["balance"]
String result = JsonOutput.toJson(item)
if (result.startsWith('[') || result.startsWith('{')) {
println JsonOutput.prettyPrint(result)
} else {
println result
}
You will want to edit this script a little, then run it to see the result.
parsed[“data”]
Uncoment the line of
def item = parsed["data"]
You run it, then you will see the following output in the Console:
parsed[“data”][“accountDetails”]
You want to comment out the previous line //def item = parsed["data"] back. And you want to uncomment another line
def item = parsed["data"]["accountDetails"]
You run it, then you will see the following output in the Console:
2026-04-25 22:25:43.345 DEBUG testcase.TC1 - 1: println(JsonOutput.prettyPrint(result))
[
{
"foo": "foo value",
"balance": 123
},
{
"bar": "bar value",
"balance": 456
},
{
"buz": "buz value",
"balance": 789
},
{
"type": "Savings",
"balance": 5000.00
}
]
2026-04-25 22:25:43.372 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/TC1
You got a bit closer to the target.
parsed[“data”][“accountDetails”][0]
You want to comment out the previous line. You want to uncomment another line
def item = parsed["data"]["accountDetails"][0]
You run it, then you will see the following output in the Console:
2026-04-25 22:28:31.313 DEBUG testcase.TC1 - 1: println(JsonOutput.prettyPrint(result))
{
"foo": "foo value",
"balance": 123
}
2026-04-25 22:28:31.339 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/TC1
Ah! You missed the target! You want the one in the following sibling.
parsed[“data”][“accountDetails”][3]
You want to comment out the previous line. You want to uncomment another line:
def item = parsed["data"]["accountDetails"][3]
You run it. Then you will see the following
2026-04-25 22:31:09.242 DEBUG testcase.TC1 - 1: println(JsonOutput.prettyPrint(result))
{
"type": "Savings",
"balance": 5000.00
}
2026-04-25 22:31:09.276 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/TC1
Closer, closer.
parsed[“data”][“accountDetails”][3][“balance”]
You want to comment out the previous line. You want to uncomment another line:
def item = parsed["data"]["accountDetails"][3]["balance"]
You run it. You will see the following result.
2026-04-25 22:32:07.208 DEBUG testcase.TC1 - 1: println(result)
5000.00
2026-04-25 22:32:07.227 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/TC1
You successfully got the number you want.
Conclusion
See https://www.baeldung.com/groovy-json for JsonSlurper and JsonOutput.
With certain programming skills, you can move around the target object and eventually come up with a solution.