jersey - Remove type-information from JSON result -
Currently I'm trying to create a webservice which only gives a list; @ Path ("/ random") @ SINGLEN Public Class Random {@GET @ path ("/") @ products (MediaType.APILICATION_JSON) Public MySsult & lt; String & gt; Test () {MyResult & lt; String & gt; Test = new MyResult & lt; String & gt; (); Test.add ("great"); Return examination; }}
And my MyResult class looks like this:
@ XMLRailAllanment public class MyResult & lt; T & gt; Applies to Iterable & lt; T & gt; {Private Arrestist & lt; T & gt; _items; Private int_total; Public MyResult () {_items = New ArrayList & lt; T & gt; (); } Public array list & lt; T & gt; GetItems () {back _items; } Public Zero Set (Arrayist & Lt; T & gt; Items) {_items = items; } Public int getTotal () {Return _total; } Public Zero Settlement (total integer) {_total = total; } Add Public Zero (T Items) {getItems (). Add (item); } Public Iterator & lt; T & gt; Iterator () {Return Mill ITEMS (). Iterator (); }} Now I get the following results from the service:
{"item": [{"@ type": "xs: string" , "$": "Weird"}], "total": "0"} but I do not want this information, I need it: It seems that I need some configuration, how do they know how to get the necessary results?
Assume that you are using Jackson, take a look at annotations. It is used to configure details of what kind of information is used with JSON serialization and discretionary. Its usage and behavior will depend on the Jackson version you are using.
Comments
Post a Comment