0

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?

1 Answer 1

1

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'
        }]
    }
}]
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.