title: Extract values from map(it's field) and write it into JSON
body: <p>Using <code>ObjectMapper</code> from <code>com.fasterxml.jackson.databind</code>is it possible to extract values from map and write it into JSON ? Without extra tag for map ?</p>
  
  <p>For example we have class:</p>
  
  <pre><code>public class LoginInfoJSON {
      private Map&lt;String, Object&gt; properties = new HashMap&lt;&gt;();
      private String username;
      private String password;
  
      //getters and setters + constructor
  }
  </code></pre>
  
  <p>If we try to convert it into JSON it will be:</p>
  
  <pre><code>{
    "properties":
       {
        "numberTest":22,
        "array":["John","Anna","Peter"],
        "nullTest":null,
        "booleanTest":true,
        "employee":{"name":"John","age":30,"city":"New York"},
        "stringTest":"String"
        },
     "username":"pwe",
     "password":"pwe"
  }
  </code></pre>
  
  <p>But is it possible to make it like that?</p>
  
  <pre><code>{
      "numberTest":22,
      "array":["John","Anna","Peter"],
      "nullTest":null,
      "booleanTest":true,
      "employee":{"name":"John","age":30,"city":"New York"},
      "stringTest":"String",
      "username":"pwe",
      "password":"pwe"
  }
  </code></pre>
  
  <p>May be some annotation can handle it ?</p>
  
  <p>Could someone please suggest something ?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>As was suggested - I should write my own serializer,</p>
  
  <p>but I am facing with problem right now:
  So here is my serizlizer:</p>
  
  <pre><code>public class ItemSerializer extends JsonSerializer&lt;Map&lt;String, Object&gt;&gt; {
  
      @Override
      public void serialize(Map&lt;String,Object&gt; map, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
          Annotation[] mapAnnotations = map.getClass().getAnnotations();
          for(int i = 0; i &lt; mapAnnotations.length; i++){
              if(mapAnnotations[i].getClass().isInstance(MapPropertiesAnnotation.class)){
                  jsonGenerator.writeStartObject();
                  for(Map.Entry&lt;String, Object&gt; mapEntry : map.entrySet()){
                      jsonGenerator.writeObjectField(mapEntry.getKey(), mapEntry.getValue());
                  }
                  jsonGenerator.writeEndObject();
              }
          }
      }
  }
  </code></pre>
  
  <p>Then I am adding this as module to <code>ObjectMapper</code>:</p>
  
  <pre><code>public class MapModule extends SimpleModule {
      public MapModule() {
          addSerializer(Map.class, new ItemSerializer());
      }
  }
  </code></pre>
  
  <p>And here during the maven build I am facing with error:</p>
  
  <pre><code>error: method addSerializer in class SimpleModule cannot be applied to given types;
  </code></pre>
  
  <p>so, I think that the problem is that I am trying to serialize <code>(Map&lt;String, Object&gt;)</code> not just <code>Map</code>.</p>
  
  <p>How should I declare then my map to serialize ?</p>