Convert data to json only if it is not already a string