Hi,

I don't think there's any OOTB adapter for that in camel. However as camel 
allows you to use XStream, Jackson, Johnson and Gson for JSON 
marshal/unmarshal, if any of these supports JSON API, possibly you can leverage 
that feature in camel DataFormat. Otherwise you can add a custom DataFormat 
which handles JSON API. Please take a look at jsonDataFormat option on Rest DSL
http://camel.apache.org/data-format.html
http://camel.apache.org/json.html
http://camel.apache.org/rest-dsl.html

Of course you can also build an object which represents JSON API style response 
in your route then you'll get a desired response.

hth,
Tomo

On 11/10/2016 01:34 PM, nareshkumar wrote:
Does camel support JSON API?

REST DSL snippet:

restConfiguration().component("restlet").host("localhost").port(9090).bindingMode(RestBindingMode.json);
        rest("/users")
                .description("User rest service")
                .consumes(MediaType.APPLICATION_JSON)
                .produces("application/vnd.api+json")
                .get()
                    .description("Get user by id")
                    .outTypeList(User.class)
                    .to("......


REST DSL returns response as below,

{"id":123,"name":"Test"}

But i  was looking for response in JSON API format.  Is there any way I can
get response in JSON API format?

like below,

{
   "data":    {
      "type": "users",
      "id": "123",
      "attributes":       {
         "id": "123",
         "name": "Test"
"relationships":       {
}
      },





--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-REST-DSL-JSON-API-tp5789980.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to