private void printMap(Map<String, Object> map) throws IOException {
        out.write(BEGIN_OBJECT); // (begin the map)
        level++;
        
        boolean first = true;
        for (final Map.Entry<String, Object> entry : map.entrySet()) {
            
            if (first) {
                first = false;
            } else {
                out.write(SEPARATOR);
            }
            
            if (pretty) {
                out.write(NEW_LINE);
                printIndent();
            }
            
            printString(entry.getKey());
            
            if (pretty) {
                out.write(SPACE);
            }
            
            out.write(ASSIGN);
            
            if (pretty) {
                out.write(SPACE);
            }
            
            print(entry.getValue());
        }
        
        level--;
        
        if (pretty && !first) {
            out.write(NEW_LINE);
            printIndent();
        }
        
        out.write(END_OBJECT); // (close the map)
    }
An internal class that can serialize java objects into JSON code.

@author Emil Forslund
@since  1.0.0
common-parent/json/src/main/java/com/speedment/common/json/internal/JsonSerializer.java