Why $jsonObject = $jsonFileData | ConvertFrom-Json this part
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"css" : ["css/light.css"],
"js": ["js/content.js"],
"run_at": "document_end"
}
is converted to this:
"content_scripts": [
{
"matches": "http://*/* https://*/*",
"css": "css/light.css",
"js": "js/content.js",
"run_at": "document_end"
}
]
as you may notice, there is no square brackets.
Other parts are okay (there is also unnecessary conversions like '<' to '\u003c' but that's another story).
Pasting all code to make it clear:
$jsonFileData = Get-Content samplemanifest.json
$jsonObject = $jsonFileData | ConvertFrom-Json
$jsonObject.name='2testani2'
$jsonFileDataToWrite = $jsonObject | ConvertTo-Json
$jsonFileDataToWrite | Out-File sample2.json
Maybe someone will shed some light on this?