Note that there are some explanatory texts on larger screens.

plurals
  1. POJson output is different in restlet
    primarykey
    data
    text
    <p>Recently i use restlet to publish some info as web service. Same code host in jetty server, but in different server i got 2 version result.</p> <p>I think when i call webservice "http://.....api/currencies.json" it will use jackson extension to convert result to json format, but i don't know why got different version.</p> <p>Is anybody can help me to figure out the problem, thanks!</p> <p>This is the code, and i use restlet extension: json, xml, jackson, xstream.</p> <pre><code>@Get("json|xml") public List&lt;CurrencyInfoDTO&gt; represent() { return ...; } @XStreamAlias("currency") public class CurrencyInfoDTO { protected String code; protected String sign; .... } </code></pre> <p>Output version 1:</p> <pre><code>{ "list": [ { "currency": [ { "code": "CNY", "sign": "¥", "rate": 1 }, { "code": "HKD", "sign": "HK$", "rate": 0.8145 }, ] } ] } </code></pre> <p>Output version 2:</p> <pre><code>[ { "code": "CNY", "sign": "¥", "rate": 1 }, { "code": "HKD", "sign": "HK$", "rate": 0.8145 } ] </code></pre> <p>The server for version 1 is host in amazon aws, and server for version 2 is my local machine for development.</p> <p>What i think is the version 1 is output as an object and version 2 is output as array.</p> <p>And i try to remove jackson extension in my local machine, it will output as version 1, so i guess version 1 is using xstream extension, and version 2 is using jackson extension, but why restlet use different extension to handle same method output?</p> <p>Thanks a lot! Rick</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload