Advertisement
Guest User

Untitled

a guest
Apr 4th, 2018
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1..2 | % { [PSCustomObject] @{
  2.     1 = Get-Random
  3.     2 = Get-Random
  4.     3 = ([PSCustomObject] @{ 4 = Get-Random; 5 = Get-Random }) | ConvertTo-Json
  5. } } | Export-Csv -NoTypeInformation c:\temp\csvjson.csv
  6.  
  7. cat $$
  8. $a = Import-Csv $$
  9.  
  10. $results = $a | % {
  11.     $output = $_
  12.     $3 = $_.3 | ConvertFrom-Json
  13.     $3.PSObject.Properties | % {
  14.         $output = $output | Add-Member $_.Name $_.Value -Pass
  15.     }
  16.     $output
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement