src/de/htwsaar/simpleHTTP/lib/Response.java
public void json(Object o) throws IOException {
        if(!(o instanceof Map)) {
            throw new RuntimeException("Dummy JSON serializer, Object type not supported");
        }

        // Hacky way of serializing a simple string->string map to a JSON object
        String toSend = "{\n";
        Map<String, String> m = (Map<String, String>) o;
        toSend += m.entrySet()
                .stream()
                .map(e -> "  \"" + e.getKey() + "\": \"" + e.getValue() + "\"")
                .reduce((xs, x) -> xs + ",\n" + x)
                .orElse("");
        toSend += "\n}";

        this.httpExchange.getResponseHeaders().add("Content-Type", "application/json");
        transmitText(toSend);
    }
/**
     * Encodes an objects (to json) and transmits it as string
     *
     * WARNING: Only a Map String->String
     *
     * @param o Object to serialize
     * @throws IOException
     */
Encodes an objects (to json) and transmits it as string
WARNING: Only a Map String->String

@param o Object to serialize
@throws IOException
Encodes an objects ( to json ) and transmits it as string WARNING : Only a Map String - > String @param o Object to serialize @throws IOException
public void json(Object o) throws IOException {
        if(!(o instanceof Map)) {
            throw new RuntimeException("Dummy JSON serializer, Object type not supported");
        }
        String toSend = "{\n";
        Map<String, String> m = (Map<String, String>) o;
        toSend += m.entrySet()
                .stream()
                .map(e -> "  \"" + e.getKey() + "\": \"" + e.getValue() + "\"")
                .reduce((xs, x) -> xs + ",\n" + x)
                .orElse("");
        toSend += "\n}";
        this.httpExchange.getResponseHeaders().add("Content-Type", "application/json");
        transmitText(toSend);
    }
public void json ( Object o ) throws IOException { if ( ! ( o instanceof Map ) ) { throw new RuntimeException ( "Dummy JSON serializer, Object type not supported" ) ; } String toSend = "{\n" ; Map < String , String > m = ( Map < String , String > ) o ; toSend += m . entrySet ( ) . stream ( ) . map ( e -> "  \"" + e . getKey ( ) + "\": \"" + e . getValue ( ) + "\"" ) . reduce ( ( xs , x ) -> xs + ",\n" + x ) . orElse ( "" ) ; toSend += "\n}" ; this . httpExchange . getResponseHeaders ( ) . add ( "Content-Type" , "application/json" ) ; transmitText ( toSend ) ; }
Encodes an objects (to json) and transmits it as string
 WARNING: Only a Map String->String
Encodes an objects ( to json ) and transmits it as string WARNING : Only a Map String - > String
// Hacky way of serializing a simple string->string map to a JSON object