datum icon indicating copy to clipboard operation
datum copied to clipboard

Convert PSCustomObject to Hashtable

Open nyanhp opened this issue 1 year ago • 2 comments

Convert the CustomObject that ConvertFrom-Json produces to a hashtable. This implementation does not use newtonsoft.json but rather haphazardly converts the PSCustomObject to a hashtable.

The alternative approach is to take on another dependency to newtonsoft.json and then do ConvertFrom-JsonNewtonsoft -String (Get-Content -Path $Path -Encoding $Encoding -Raw) | ConvertTo-Datum -DatumHandlers $DatumHandlers

nyanhp avatar Aug 16 '23 11:08 nyanhp

I don't really get why we need this and why we don't use ConvertFrom-Yaml for the JSON... I only had a look on my phone for a sec...

gaelcolas avatar Aug 18 '23 09:08 gaelcolas

I was unaware that a YAML module would convert JSON. Sounds like a simple fix then.

nyanhp avatar Aug 18 '23 10:08 nyanhp