title: How to serialize a map with enum keys in declaration order with JSON?
body: <p>I have some enum class, let's imagine</p>
  
  <pre><code>public enum MyEnum {
      ONE("one"), TWO("two"), THREE("three"), DEFAULT("some value")
      //..
  }
  </code></pre>
  
  <p>and Dto class: </p>
  
  <pre><code>@JsonPropertyOrder(value = {"id", "name", "params"})
  public Dto {
      private Long id;
      private String name;
      private Map&lt;MyEnum, Object&gt; params;
  }
  </code></pre>
  
  <p>How can I setup order for <strong>keys</strong> in <strong>params</strong> map? I know that LinkedHashMap can be used to setup order and just add to map in proper order. But! There are cases, when key-value should be added in runtime and it should be added to <strong>params</strong> map not to last link, but inside map. e.g.</p>
  
  <pre><code>params = new LinkedHashMap();
  params.put(ONE, new String("object1"));
  params.put(THREE, new String("object #3"));
  </code></pre>
  
  <p>and than in another place of code we just added </p>
  
  <pre><code>params.put(TWO, new Integer(20));
  </code></pre>
  
  <p>and order inside json should be: </p>
  
  <pre><code>{
   "id":"123", "name":"some name", 
  "params":{"ONE":"object1","TWO":"20","THREE":"object #3"}
   }
  </code></pre>