Author Posts

December 13, 2017 at 9:01 am


I'm currently stuck on importing a Json file. I could boil it down to this example:

'{"FiltList":{"1":"a","2":["b","c"]}}' | ConvertFrom-Json

@{1=a; 2=System.Object[]}

How can I convert the array ["b","c"] to an usefull object instead of "System.Object[]"


December 13, 2017 at 10:02 am

$a = '{"FiltList":{"1":"a","2":["b","c"]}}' | ConvertFrom-Json

1 2     
- -     
a {b, c}

December 13, 2017 at 10:10 am

Some times I'm slow on the uptake. Thanks for the clarification.

December 14, 2017 at 1:28 pm

PS /Users/me> ($a.filtlist.2)[0]                                            
PS /Users/me> ($a.filtlist.2)[1]                                            

December 22, 2017 at 7:16 am

Just to conclude this topic.
I was struggling because in my code I've set up an hash table with a hash table inside with an array inside. I've used this structure to do some work.

After several iterations I've saved this structure to a json file. When importing this json file to continue the work I was running in quite some trouble accessing the values, because what I'm getting back was not my initial structure but a psobject.

I've solved this problem by initializing the whole structure with psobjects. So my code can access the structure in the first and each following run.