I am getting some json data from a API, however I don't need most of this data. I am trying to remove some fields so that the when I save this data as a json file it isn't so large. I doesnt seem to be removing any of the fields I am trying to remove.
Code:
$Response = Invoke-RestMethod -Uri "https://mtgjson.com/api/v5/AllPrintings.json" -Method GET
$Obj = ConvertFrom-Json $Response
$Obj.PSObject.Properties.Remove('booster')
$Obj.PSObject.Properties.Remove('cards')
$Obj | ConvertTo-Json | Out-File ./All-Sets-Data.json -Force
Json:
{
"data": {
"10E": {
"baseSetSize": 383,
"block": "Core Set",
"booster": "@{default=}",
"cards": "",
"code": "10E",
...
},
"2ED": {
"baseSetSize": 302,
"block": "Core Set",
"booster": "@{default=}",
"cards": "",
"code": "2ED",
...
},
"2XM": {
"baseSetSize": 332,
"booster": "@{default=}",
"cards": "",
"code": "2XM",
...
},
...
}
}