Item overwrite method

I have a JSon object that is converted to a hash (table):

PS C:\> @{ "key1" = "1"; "key2" = "2" }.keys key2 key1 

everything is fine. but the JSon object generator solved the following:

 PS C:\> @{ "key1" = "1"; "keys" = "2" }.keys 2 

which quickly tears me apart. it is amazing that this can happen. Can anyone suggest how to make a hash safe?

TIA - e

+4
source share
1 answer

In case of conflicting / overriding property names, you can always access the properties of the base object using psbase for example:

 PS C:\> @{ "key1" = "1"; "keys" = "2" }.psbase.keys key1 keys 
+6
source

Source: https://habr.com/ru/post/1495420/


All Articles