title: Spring MVC jackson and order
body: <p>I need to return a list of ordered String from an ajax Call </p>
  
  <p>my DTO has an attributes sizes which is a list of String values , eg : 36,38,40/46, 46, S, XS, M, L</p>
  
  <p>my comparator and sorting algorithm work well , the list of sizes is well sorted until its converted to json format, i found a totally different order .</p>
  
  <pre><code>@ResponseBody
  @RequestMapping(value = PRODUCT_CODE_PATH_VARIABLE_PATTERN + "/crossell", method = RequestMethod.GET)
  public ProductData cosselProductDetail(@PathVariable("productCode") final String productCode,
          final HttpServletResponse response) throws CMSItemNotFoundException,
          UnsupportedEncodingException
  {
  
     Collections.sort(sortedSizes,mycomparator);
      productData.setSizes(sortedSizes);
      return productData;   
  }
  </code></pre>
  
  <p>the spring config is the default configuration no thing added or modified .</p>
  
  <pre><code>&lt;!-- activates annotation driven binding --&gt;
  &lt;mvc:annotation-driven ignoreDefaultModelOnRedirect="true" validator="validator"&gt;
      &lt;mvc:message-converters&gt;
          &lt;bean class="org.springframework.http.converter.ResourceHttpMessageConverter"/&gt;
          &lt;bean class="org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter"/&gt;
          &lt;bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" /&gt;
      &lt;/mvc:message-converters&gt;
  &lt;/mvc:annotation-driven&gt;
  </code></pre>
  
  <p>after searching all around , all what i found is the serialisation key config : SORT_PROPERTIES_ALPHABETICALLY , which order the properties not the values.</p>
  
  <p>Thanks </p>