Function transformAndValidateSyncFix

Fixes transformAndValidateSync that throws "unexpected token 'i', "filename" is not valid JSON" for string!