JsonSerializer

public abstract class JsonSerializer implements Serializer

An abstract JSON serializer class. The class which inherits this, needs to implement toJson method This class will be used in send a serialize JSON data as a response

Fields

contentType

String contentType

Methods

serialize

public void serialize(HttpRequest request, HttpResponse response)

toJson

public abstract byte[] toJson(HttpRequest req, HttpResponse resp)

This method is used to serialize data in JSON format

Parameters:
  • req – The http request for which the data is being serialized
  • resp – The http response object which sends this serialized data.