Forum Discussion
Mottz84
Aug 10, 2022Copper Contributor
ConvertFrom-Json with content like $$ or $^
trying figure out on how I can store $$ and $^ in a json object or file and then convert it from JSON to a customObject with the right content in PowerShell But seemingly I have no option to escape ...
- Aug 11, 2022
Yeah, either what farismalaeb said or use literal quoting instead around the text block like so (assuming you're not trying to do any internal variable replacements):
@' { "bla": "^$$WS\\:$^W'" } '@ | ConvertFrom-Json
Cheers,
Lain
farismalaeb
Aug 11, 2022Iron Contributor
You need to use the ` to tell powershell not to parse the $
@"
{
"bla": "^`$`$WS\\:`$^W'"
}
"@ | ConvertFrom-Json
@"
{
"bla": "^`$`$WS\\:`$^W'"
}
"@ | ConvertFrom-Json