`from_yaml` seems to strips newlines from values in yaml strings

Name: "{{item.name}}"
Platform: "{{item.platform}}"
Attributes:
  PlatformCredential: "{{platform_credential.stdout|regex_replace('\n', '\\n')}}"
  PlatformPrincipal: "{{platform_principal.stdout|regex_replace('\n', '\\n')}}"

- debug:
    msg: "{{lookup('template', 'create-platform-application.yml.j2')|from_yaml}}"

Any way to get around this without having to escape all values with possible newlines?