Accepted answer

Finally, I have resolved the error by changing how the JSON value is created. Instead of using the json4s wrapper:


I switched to using Jackson mapper directly:


Edit: In my ScalatraBootstrap.init() method, I have defined the Jackson's ObjectMapper:

import com.fasterxml.jackson.databind.ObjectMapper

class ScalatraBootstrap extends LifeCycle {

    override def init(context: ServletContext) {

        implicit val objectMapper = new ObjectMapper

        //omitting the rest of the code...

And here is my service class where I'm fetching the net.example.MyClass and transforming it to JSON with the ObjectMapper:

import net.example.MyClass
import com.fasterxml.jackson.databind.ObjectMapper

class MyService(val objectMapper: ObjectMapper) {

    def getMyClassAsJson() {
        val result: MyClass = // calling a service which provides the MyClass object
        return objectMapper.writeValueAsString(result)


you post the json including net.example.MyClass[]. As MyClass[] is a array, the ScalaSig cannot resolved object array, so you should use ArrayList<net.example.MyClass>.

Related Query

More Query from same tag