Your data.json is an array with a single name-value pair.. so, convert it to a PSCustomObject, reference the first element in the array, and convert it back to JSON.
(@'
[
{
"DateandTime": "2021-01-14T16:30:31.000Z",
"Value1": 3,
"Value2": 13939.71
}
]
'@ | ConvertFrom-Json)[0] | ConvertTo-Json
results in:
{
"DateandTime": "2021-01-14T16:30:31.000Z",
"Value1": 3,
"Value2": 13939.71
}
You can probably add more logic on the command line, but I hope it helps.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…