10

I am looking into Java (possibly Scala) for a project that will use Ember and ember-data. I know I can write a backend to format the JSON, but I was wondering if there are any Java packages for Java more capable for building the JSON strings in a format that will utilize the DS.RESTAdapter more effectively without building something completely custom?

Something similar to Rails Active Model Serializers would be ideal, or a JSON serializer and a replacement REST adapter for Ember.

Just asking you all before I need to build something from scratch. Thanks!

awildeep
  • 115
  • 1
  • 8
  • You know http://jackson.codehaus.org/? – Thomas Junk Jun 06 '13 at 17:34
  • I have not been a Java dev for about 10 years, so I am very much out of the loop. I have seen JAX-RS mentioned, and the basic toJSON(), also I just found http://xstream.codehaus.org/json-tutorial.html but I am doing basic research now, I may attempt to build a basic server this weekend if I can get an idea of wich libraries to try and implement. – awildeep Jun 06 '13 at 17:47
  • Spring does the Job in our Application. If Jackson is found in the classpath, spring automatically uses Jackson to do the serialisation. – Thomas Junk Jun 06 '13 at 17:59
  • @Lilith2k3 Does Jackson's output format match what ember-data is looking for via DS.RESTAdapter? Are there any customizations needed for this? – awildeep Jun 06 '13 at 22:26
  • Yes and No. With Spring we are dealing with simple POJOs. So the structure of the output via Jackson is dependent on the POJO you created. So if you want [{name:"Doe", firstname:"John"}] you have to handover a List to Jackson. Hence Spring is MVC, you have a controller ( POJOs with annotations marking a class as Controller and annotations marking methods as endpoints) returning either a view (in our case JSPs) or data to serialize. So a possible method would be Public List showAllFriends() and Spring uses Jackson to produce the JSON output. – Thomas Junk Jun 07 '13 at 06:59

1 Answers1

2

I would look into any of the following frameworks or libraries to create REST APIs with java and/or scala:

Scott B
  • 1,665
  • 1
  • 15
  • 14
  • I would add [Grails](http://grails.org/) to that list. It's not Scala or Java, but if Scala is an option, Groovy (the language Grails is implemented in) is quite close. Grails doesn't have a native JSON API marshaller (yet), but neither do most of the other JVM frameworks. – cdeszaq Jan 13 '14 at 20:56