toJSON support

@corinnekrych added toJSON support plus tests and refactored our existing model for clarity 

let me know what u think
that will be really nice but I think due to Swift lack of reflection API (apart from some hacks outline in my [JIRA comment](https://issues.jboss.org/browse/AGIOS-245?focusedCommentId=13014546&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13014546) we can't do much in-here

I hope that is what you mean, if not feel free to open PR against it with you proposal to look at and we can discuss it