{"action":"created","issue":{"url":"https://api.github.com/repos/grails/grails-core/issues/9401","labels_url":"https://api.github.com/repos/grails/grails-core/issues/9401/labels{/name}","comments_url":"https://api.github.com/repos/grails/grails-core/issues/9401/comments","events_url":"https://api.github.com/repos/grails/grails-core/issues/9401/events","html_url":"https://github.com/grails/grails-core/issues/9401","id":115306164,"number":9401,"title":"JSON converter should maintain order of one-to-many relations","user":{"login":"houbie","id":483753,"avatar_url":"https://avatars.githubusercontent.com/u/483753?v=3","gravatar_id":"","url":"https://api.github.com/users/houbie","html_url":"https://github.com/houbie","followers_url":"https://api.github.com/users/houbie/followers","following_url":"https://api.github.com/users/houbie/following{/other_user}","gists_url":"https://api.github.com/users/houbie/gists{/gist_id}","starred_url":"https://api.github.com/users/houbie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houbie/subscriptions","organizations_url":"https://api.github.com/users/houbie/orgs","repos_url":"https://api.github.com/users/houbie/repos","events_url":"https://api.github.com/users/houbie/events{/privacy}","received_events_url":"https://api.github.com/users/houbie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-05T15:19:59Z","updated_at":"2015-11-05T20:46:01Z","closed_at":null,"body":"When sorting a relation with\r\n```\r\nclass Parent {\r\n    static hasMany = [children: Child]\r\n    static mapping = { children sort: 'name'} \r\n}\r\n```\r\nthe order is lost after converting to json:\r\n```\r\nParent.get(1) //children are sorted\r\nJSON.use('deep'){\r\n    Parent.get(1) as JSON  //children are NOT sorted\r\n}\r\n```\r\n\r\nThis issue has already been reported in [this JIRA](https://jira.grails.org/browse/GRAILS-8849)"},"comment":{"url":"https://api.github.com/repos/grails/grails-core/issues/comments/154185262","html_url":"https://github.com/grails/grails-core/issues/9401#issuecomment-154185262","issue_url":"https://api.github.com/repos/grails/grails-core/issues/9401","id":154185262,"user":{"login":"Schlogen","id":1583789,"avatar_url":"https://avatars.githubusercontent.com/u/1583789?v=3","gravatar_id":"","url":"https://api.github.com/users/Schlogen","html_url":"https://github.com/Schlogen","followers_url":"https://api.github.com/users/Schlogen/followers","following_url":"https://api.github.com/users/Schlogen/following{/other_user}","gists_url":"https://api.github.com/users/Schlogen/gists{/gist_id}","starred_url":"https://api.github.com/users/Schlogen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Schlogen/subscriptions","organizations_url":"https://api.github.com/users/Schlogen/orgs","repos_url":"https://api.github.com/users/Schlogen/repos","events_url":"https://api.github.com/users/Schlogen/events{/privacy}","received_events_url":"https://api.github.com/users/Schlogen/received_events","type":"User","site_admin":false},"created_at":"2015-11-05T20:46:01Z","updated_at":"2015-11-05T20:46:01Z","body":"`children` is a set and therefore has no order. You can change the type to `List` and with an additional column in the table, order can be kept."}}