class JsonResponseFormatter implements ResponseFormatter {

    @Override
    public byte[] formatResponse(final WilmaHttpRequest wilmaRequest, final HttpServletResponse resp,
                                 final byte[] templateResource, final ParameterList params) {
        JsonElement response = new JsonParser().parse(new String(templateResource, StandardCharsets.UTF_8));

        new NonRecursiveJsonTreeEvaluator(wilmaRequest.getBody()).replaceAllNonRecursive(response);

        return response.toString().getBytes();
    }

}