Reputation: 357
I have a file containing of:
[{
'item1' : 'value1',
'item2' : [
'internalItem1' : 'value'
]
},
{
'item1' : 'value2',
'item2' : [
'internalItem1' : 'value',
'item2' : [
'internalItem1' : 'value',
'internalItem2' : 'value'
]
]
}]
I'd like to put it in an array of json objects. How can I do it? This is how I'm managing with a file containing of one JSON object:
$json = (Get-Content $fileLocation) | ConvertTo-Json
But the array of them is giving me nighthmares, how can I process this data?
Upvotes: 0
Views: 147
Reputation: 4689
Looks like you need commas on the end of the lines:
[{
'item1' : 'value1',
'item2' : {
'internalItem1' : 'value'
}
},
{
'item1' : 'value2',
'item2' : {
'internalItem1' : 'value',
'item2' : [{
'internalItem1' : 'value',
'internalItem2' : 'value'
}]
}
}]
Upvotes: 1