I am new to this and new to JSON. I thought JSON was always key value pairs and the values were always strings, now I have to be able to export a CSV file to “JSON” using specific data types for each field
These are the data types for each key:value pair
[{“FIELD_1”: String,
“FIELD_2”: Int,
“FIELD_1”: Int,
“FIELD_1”: Int,
“ACTION”: String,
“FIELD_1”: String or null,
“FIELD_1”: String or null,
“FIELD_1”:String,
“FIELD_1”: List[String],
“FIELD_1”: String,
“FIELD_1”: Int or null,
“FIELD_1”: Int or null,
“FIELD_1”: List[String],
“FIELD_1”: String or null,
“FIELD_1”: String,
“FIELD_1”: Int,
“FIELD_1”: List[String],
“FIELD_1”: String or null,
“FIELD_1”: String,
“FIELD_1”: String or null,
“FIELD_1”: String or null}]
I tried to do this in PowerShell by casting the variables types that hold each field to the appropriate type but the ConvertTo-Json cmdlet just converted them all to strings and puts an empty string (“”) in empty fields instead of a null character.
The only other scripting language I have access to is Python, but I am a complete novice, I have followed a few folk on youtube doing small scripts for network management or testing but I don’t know where or how to get started with this, to be fair I don’t even know if this is this possible in Python? Can anyone direct me to resources that might help get me started?