Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRAILS-10499: Malformed JSON for Restful Resource of type collection when exposed using HAL #3673

Closed
graemerocher opened this issue Sep 17, 2013 · 1 comment

Comments

@graemerocher
Copy link
Member

Original Reporter: sukrit007
Environment: Not Specified
Version: 2.3
Migrated From: http://jira.grails.org/browse/GRAILS-10499

Given a domain object "Person" that is exposed as restful resource

{code:title=Person.groovy|borderStyle=solid}
package com.meltmedia

import grails.rest.Resource;

@resource(uri='/api/persons', formats=['hal', 'json'])
class Person {

String firstName
String middleName
String lastName
String emailAddress

static constraints = {
    firstName size:1..100
    middleName size:1..100, nullable:true
    lastName size:1..100
    emailAddress size:1..255, email:true
}

}
{code}

When I try to access the persons collection
{noformat}
curl -H "Accept: application/hal+json" http://localhost:8080/rest-demo/api/persons
{noformat}

Then my output JSON is not well formed with missing "}" at the end of the response.

{noformat}
{
"_links": {
"self": {
"href": "http://localhost:8080/rest-demo/rest-demo/api/persons",
"hreflang": "en",
"type": "application/hal+json"
}
},
"_embedded": [
{
"_links": {
"self": {
"href": "http://localhost:8080/rest-demo/api/persons/1",
"hreflang": "en",
"type": "application/hal+json"
}
},
"emailAddress": "sukritxxxx@uyyyyy.com",
"firstName": "Sukrit",
"lastName": "Khera"
}
]
{noformat}

Pull Request: #398

@graemerocher
Copy link
Member Author

graemerocher said:
Thanks for the pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant