Announcement Announcement Module
Collapse
No announcement yet.
Disable HAL content type (application/hal+json) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Disable HAL content type (application/hal+json)

    Note: this question has also been posted on Stack Overflow

    Hi,

    Using Spring Data REST with JPA in version 2.0.2.RELEASE.
    How can I disable Hypertext Application Language (HAL) in the JSON ? http://stateless.co/hal_specification.html

    I have tried many things already, but to no avail. For example, I have set Accept and Content-type headers to "application/json" instead of "application/hal+json" but I still receive the JSON content with hyper links.

    For example, I'd like to get something like:
    Code:
    {
    "name" : "Foo",
    "street" : "street Bar",
    "streetNumber" : 2,
    "streetLetter" : "b",
    "postCode" : "D-1253",
    "town" : "Munchen",
    "country" : "Germany",
    "phone" : "+34 4410122000",
    "vat" : "000000001",
    "employees" : 225,
    "sector" : {
         "description" : "Marketing",
         "average profit": 545656665,
         "average employees": 75,
         "average profit per employee": 4556
         }
    }
    Instead of:
    Code:
    {
    "name" : "Foo",
    "street" : "street Bar",
    "streetNumber" : 2,
    "streetLetter" : "b",
    "postCode" : "D-1253",
    "town" : "Munchen",
    "country" : "Germany",
    "phone" : "+34 4410122000",
    "vat" : "000000001",
    "employees" : 225,
    "_links" : {
         "self" : {
              "href" : "http://localhost:8080/app/companies/1"
         },
         "sector" : {
              "href" : "http://localhost:8080/app/companies/1/sector"
         }
    }
    }
    Last edited by landrain; Apr 24th, 2014, 04:50 AM.
Working...
X