This topic has not yet been written. The content below is from the topic description.
Example 44.5. Marshalling example The RESTEasy JavaScript client API can automatically marshall JSON and XML: @Path("orders") public interface Orders { @XmlRootElement public static class Order { @XmlElement private String id; public Order(){} public Order(String id){ this.id = id; } } @Path("{id}/xml") @PUT @Consumes("application/xml") public void putOrderXML(Order order){ // store order } @Path("{id}/json") @PUT @Consumes("application/json") public void putOrderJSON(Order order){ // store order } } Let us look at what the preceding JAX-RS API would give us on the client side: // this saves a JSON object Orders.putOrderJSON({$entity: {id: "23"}}); // It is a bit more work with XML var order = document.createElement("order"); var id = document.createElement("id"); order.appendChild(id); id.appendChild(document.createTextNode("23")); Orders.putOrderXML({$entity: order});