I have the following domain class
class Settings {
static constraints = {
pageID(nullable: false, unique: true)
lp()
}
String pageID
Map lp
}
I'm querying the DB like SO:
...
def query = Settings.where {pageID == id}
def result = query.find()
Here is a screen shot of the evaluated result:
Now I'm looking for a way to format the result as a JSON like so:
{"lp":{"account":"12345678","appKey":"64dsfg64dg64fg65dfg6","domain":"my.domain.com"},"pageID":"123456"}
What is the right way to extract the fields out? It would be best if I can avoid getting each field manually. Thanks :)