Incorrect JSON rendering by HalJsonRenderer, if creating a custom GSON TypeAdapter

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Incorrect JSON rendering by HalJsonRenderer, if creating a custom GSON TypeAdapter

sbglasius
I've been trying to use Joda with the HalJsonRenderer, but got an error where dates are quoted twice. 

I have filed a Jira: http://jira.grails.org/browse/GRAILS-10977 and I have actually attempted to create a fix for it as well.

When I registered a custom TypeAdapter for GSON, it looks like it's escaping an already quoted value, looking like this:

{
_links: {
...
},
_embedded: {
conference: [
{
_links: {
...
}
end: "\"2014-06-04\"",
name: "GR8Conf Europe 2014",
start: "\"2014-06-02\""
}
]
}
}

The correct output should look like this:
{
_links: {
...
},
_embedded: {
conference: [
{
_links: {
...
}
end: "2014-06-04",
name: "GR8Conf Europe 2014",
start: "2014-06-02"
}
]
}
}

I think this partly has to do with this bug: http://jira.grails.org/browse/GRAILS-10372 which has been resolved.

Med venlig hilsen / Best regards,
Søren Berg Glasius

Hedevej 1, Gl. Rye, DK-8680 Ry, Denmark
Mobile: (+45)40449188, Skype: sbglasius
--- Press ESC once to quit - twice to save the changes.