added conversion from objects to JSON when content type is set