[jboss-user] [JBoss Web Services] - Resteasy: Object to JSON capitalization?

Ben Meyer do-not-reply at jboss.com
Tue Feb 12 03:15:14 EST 2013


Ben Meyer [https://community.jboss.org/people/pr0st] created the discussion

"Resteasy: Object to JSON capitalization?"

To view the discussion, visit: https://community.jboss.org/message/797191#797191

--------------------------------------------------------------
Hi Guys,
I am pretty new to Resteasy and everything that belongs to it and I 
have a tiny problem that sounds actually pretty easy to fix but I was not able to...
I have a JavaScript library which is expecting a capitalized JSON node.
Unfortunately I am not able to make any changes in that library so I need to
figure out a way, to fix this problem in the java part. I don't have anything fancy,
just 2 classes like this:
{code}
public class Body {

  private String def;
  private List<Employee> employees;

  public String getDef() {

    return def;
  }

  public void setDef(String def) {

    this.def = def;
  }

  public List<Employee> getItems() {

    return employees;
  }

  public void setItems(List<Employee> items) {

    employees = items;
  }

}
{code}
and
{code}
public class Employee {

  private String name;

  public String getName() {

    return name;
  }

  public void setName(String name) {

    this.name = name;
  }

}
{code}

The final JSON Code looks like this:
{"body":{"def":"Task","items":[{"name":"Test Name"}]}}

but I want it to look like this:
{"Body":{"Def":"Task","Items":[{"name":"Test Name"}]}}

Is there any way to handle this problem? Any annotation for renaming the nodes maybe?

Regards and thanks in advance,
pr0st
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/797191#797191]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130212/5e13c6d6/attachment-0001.html 


More information about the jboss-user mailing list