Home Name value pairs in Grails Views
Reply: 0

Name value pairs in Grails Views

user527
1#
user527 Published in August 16, 2018, 6:16 am

I have a Header class like so:

class Header {
  String name
  String value
}

I have a Grails View like this:

model {
  Set<Header> headers
}

json {
  headers ....
}

I want to produce JSON formatted like this:

{
  "headers": {
    "Host": "xyz.com",
    "Other-Header": "da value"
  }
}

I tried generating the JSON value by hand, but Grails just put it inside quotes. So that didn't work.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.297693 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO