Created
December 12, 2010 04:25
-
-
Save drlongnecker/737845 to your computer and use it in GitHub Desktop.
Odd formatting with PowerShell and Json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Doesn't work: | |
$data = "`"{'message':{'body':'{0} - {1}'}}`"" -f $message, $url | |
Throws: | |
Error formatting a string: Input string was not in a correct format.. | |
At Script.ps1:11 char:50 | |
+ $data = "`"{'message':{'body':'{0} - {1}'}}`"" -f <<<< $message, $url | |
+ CategoryInfo : InvalidOperation: (System.Object[]:Object[]) [], RuntimeException | |
+ FullyQualifiedErrorId : FormatError | |
Works: | |
$data = "`"{'message':{'body':'" + $message + " - " + $url + "'}}`"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment