I have a grails object that I am converting using def json = object as JSON
. After I have it converted I want to add one more property called pin
to the JSON which looks like the following.
[location:[lat:23.03, lon:72.58]]
Only way to do this so far seems like following
- Serialize the DomainClass to JSON using grails.converters.json
- Convert the JSON to string
- Create JSONBoject using the string from Step 2
- Add the property
- Convert it back to String
Any other way to do this using grails.converters.json? I have tried using Gson but I do not want to go that route because I am getting many Circular Reference Errors