Been working this for an hour now and can't get to the bottom of it. The following code builds an array of hashtables, adds that array into another hashtable along with a bunch of other key-value pairs, then converts the whole lot to JSON:
$01_ch_channel_hist_id = @{"ColumnName"="01_ch_channel_hist_id";"ColumnType"="bigint"}
$02_ch_channel_id = @{"ColumnName"="02_ch_channel_id";"ColumnType"="bigint"}
$08_ch_load_id = @{"ColumnName"="08_ch_load_id";"ColumnType"="bigint"}
$columns = $01_ch_channel_hist_id,$02_ch_channel_id,$08_ch_load_id
$ChannelDimH = @{}
$ChannelDimH.Add("Columns",$columns)
$ChannelDimH.Add("TableName","CHANNEL_DIM_H")
$ChannelDimH.Add("UniqueColumn","channel_id")
$tables = @()
$tables += $ChannelDimH
$sqoopOracleTableAndColumnMetadata = @{}
$sqoopOracleTableAndColumnMetadata.Add("tables",$tables)
$sqoopOracleTableAndColumnMetadata | ConvertTo-Json
Here is the output:
{
"tables": [
{
"TableName": "CHANNEL_DIM_H",
"UniqueColumn": "channel_id",
"Columns": "System.Collections.Hashtable System.Collections.Hashtable System.Collections.Hashtable"
}
]
}
Notice that the hastables inside the "Columns" array get returned as:
"System.Collections.Hashtable System.Collections.Hashtable System.Collections.Hashtable"
The data in those hashtables isn't appearing in my JSON document. Why not?