Provide a method to serialize posts into JSON.