I'm collecting data in raw text with RESTAPI from an appliance and I would like to replace a particular block of text from it.
I'm not very comfortable with types and I'm stuck on this since hours.
Let say here is my original text :
{
"type": "V9",
"firmware": {
"manageFirmware": false,
"reapplyState": "NotApplying"
},
"inProgress": false,
"connectionSettings": {
"reapplyState": "NotApplying",
"connections": [
"@{id=1; name=PR_1; state=Deployed; status=OK}",
"@{id=2; name=PR_2; state=Deployed; status=OK}",
"@{id=3; name=SN_1; state=Reserved; status=Unknown;}",
"@{id=4; name=SN_2; state=Reserved; status=Unknown;}"
]
},
"Tag": "123456"}
I would like to replace the block after "connections" : :
[ "@{id=1; name=PR_1; state=Deployed; status=OK}",
"@{id=2; name=PR_2; state=Deployed; status=OK}",
"@{id=3; name=SN_1; state=Reserved; status=Unknown;}",
"@{id=4; name=SN_2; state=Reserved; status=Unknown;}"
]
By another text block I'm currently able to collect, let say this one :
[
{
"id": 1,
"name": "PR_1",
"state": "Deployed",
"status": "OK",
},
{
"id": 2,
"name": "PR_2",
"state": "Deployed",
"status": "OK",
},
{
"id": 3,
"name": "SN_1",
"state": "Reserved",
"status": "Unknown",
},
{
"id": 4,
"name": "SN_2",
"state": "Reserved",
"status": "Unknown",
}
]
The goal for me is to remove the "@, replace = with :, and remove } at the end of the line.
I already tried something with the -Replace option but it was not very concluding.
Also tried with some Regex but I'm very struggling for this one.