use of com.thoughtworks.go.api.base.JsonOutputWriter in project gocd by gocd.
the class ControllerMethods method jsonizeAsTopLevelObject.
default String jsonizeAsTopLevelObject(Request request, Consumer<OutputWriter> consumer) {
StringWriter writer = new StringWriter(1024);
new JsonOutputWriter(writer, RequestContext.requestContext(request)).forTopLevelObject(consumer);
return writer.toString();
}
use of com.thoughtworks.go.api.base.JsonOutputWriter in project gocd by gocd.
the class MessageJson method toString.
public String toString() {
StringWriter buffer = new StringWriter(1024);
new JsonOutputWriter(buffer, null).forTopLevelObject((OutputWriter writer) -> {
writer.add("message", message);
if (data != null) {
writer.add("data", data);
}
});
return buffer.toString();
}
use of com.thoughtworks.go.api.base.JsonOutputWriter in project gocd by gocd.
the class ControllerMethods method jsonizeAsTopLevelArray.
default String jsonizeAsTopLevelArray(Request request, Consumer<OutputListWriter> consumer) {
StringWriter writer = new StringWriter(1024);
new JsonOutputWriter(writer, RequestContext.requestContext(request)).forTopLevelArray(consumer);
return writer.toString();
}
Aggregations