If a save a table with empty values in one of the numerical columns like this:
New Table( "testEmpty",
Add Rows( 2 ),
New Column( "Col1",
Character,
"Nominal",
Set Selected,
Set Values( {"test", "test"} )
),
New Column( "Col2",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [., .] )
)
)
as a JSON file, it will result in this:
[
{
"Col1" : "test",
"Col2" : .
},
{
"Col1" : "test",
"Col2" : .
}
]
Looks like not everybody agrees that this is a valid JSON syntax. If I read this file back to JSON using, let's say, Powershell:
$json = Get-Content -Path 'C:\Users\myUser\testEmpty.json' -ErrorAction Stop | ConvertFrom-Json
it will error out:
ConvertFrom-Json : Invalid JSON primitive: ..
At C:\Users\myUser\testEmpty.ps1:1 char:118
+ ... \myUser\testEmpty.json' -ErrorAction Stop | ConvertFrom-Json
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [ConvertFrom-Json], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand
Any idea how to fix this? Any options when saving JSON files using scripts? Or the only workaround is to make sure the table doesn't have empty values?