PSYaml icon indicating copy to clipboard operation
PSYaml copied to clipboard

ConvertFrom-Yaml and Convert-YamlToJson Cmdlets do not work with string[] as returned by Get-Content

Open avonwyss opened this issue 7 years ago • 4 comments

This can be worked around by using -Raw on the Get-Content Cmdlet, but it would be nice if the Cmdlets would behave the same as the original ones for Json, Csv and Xml, which seem to have no issue with string[] as returned from Get-Content.

avonwyss avatar Apr 23 '18 15:04 avonwyss

Agreed, it would be a good idea to fix this. It is an aim to make these cmdlets as compatible as possible to the JSON ones

Phil-Factor avatar Apr 24 '18 08:04 Phil-Factor

Just bumped into this myself, was rather confused and kept checking different YAML linters to see if I was doing anything wrong in my YAML.

rsteenwyk avatar Jun 04 '18 20:06 rsteenwyk

ConvertTo-YAML (get-content 'MyPath\test.txt')

... produces ...

  • 'There was a Young Person of Crete,'
  • 'Whose toilette was far from complete;'
  • 'She dressed in a sack,'
  • 'Spickle-speckled with black,'
  • 'That ombliferous person of Crete.'
  • 'There was a Young Lady of Dorking,'
  • 'Who bought a large bonnet for walking;'
  • 'But its colour and size,'
  • 'So bedazzled her eyes,'
  • 'That she very soon went back to Dorking.'

is this wrong?

Phil-Factor avatar Mar 22 '19 14:03 Phil-Factor

Aargh. Caught out by the markdown. Read those as dashes

Phil-Factor avatar Mar 22 '19 14:03 Phil-Factor