Add functionality to serialize data to JSON.