Prints the content of the object in specified format.
format
The format type.
Returns a string with the objects contensts in the specified format.