如何获取json的值,其中键有"quot;一开始?
$json = '{".expires":"2022-10-13"}' | ConvertFrom-Json
cls
$json..expires #trying to get the value 2022-10-13
错误:
On the line:4 caractere:8
+ $json..expires
+ ~
You must provide a value expression after the '..' operator.
On the line:4 caractere:8
+ $json..expires
+ ~~~~~~~
Token 'expires' unexpected in the expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
如果我放了一个冒号,上面的代码会出错,有其他方法吗?
您可以将属性名称用引号括起来。
$json.".expires"