I have a text area, and I do get a text from that area
The text that I get
{
"Title":"title",
"First Name":"first_name",
"Last Name":"last_name",
"Prefix":"prefix",
"Total Number":"total_number"
}
Now how do I get only text Title, First Name, Last Name, Prefix, Total Number
Thanks in advance
1 Like
You need to parse the JSON text. See the following:
1 Like
Thank you, and Do you know how to import java lib to Katalon?
1 Like
which one? please detail your question.
1 Like
import groovy.json.JsonSlurper
def jsonString = '''
{
"Title":"title",
"First Name":"first_name",
"Last Name":"last_name",
"Prefix":"prefix",
"Total Number":"total_number"
}
'''
def jsonSlurper = new JsonSlurper()
def jsonObject = jsonSlurper.parseText(jsonString)
def keys = jsonObject.keySet()
keys.each { key ->
println("Key: $key")
}
I mean, where can I download the library to import into Katalon?
bionel
7
JsonSlurper is already provided in katalon, no need to download anything.