Try to avoid keeping multiple representations of the same data on disk. Since you have Python and JSON in the mix already, I'd recommend JSON as the disk format. Here are two examples; the first assumes you prefer the associative array in JMP and the second assumes a data table. I lean towards the first one because the names work better (below.)
// 1st example using Associative Array
variables = ["nThings" => 3,
"type" => "favs",
"things" => {"raindrops", "whiskers", "kettles"}];
filename = Save Text File( "$temp/variables.json", As JSON Expr( variables ) );
restoredVariables = Parse JSON( Load Text File( filename ) );
// this is not needed unless you want to compare the restored data to the original...
If( variables == restoredVariables,
Write( "\!nGood restore\!n" ),
Write( "\!nRestore does not match\!n" )
);
Show( variables, restoredVariables );
// 2nd example, using data table
dt = New Table( "variables",
New Column( "key", "character", values( variables << getkeys ) ),
New Column( "val", "expression", values( variables << getvalues ) )
);
dt << save( "$temp/table.json" );
dtRestored = Open( "$temp/table.json" );
dtRestored:val << datatype( "expression" );
// this is not needed, unless you want to compare the restored table to the original...
ok = (dt << Compare Data Tables( showwindow( 0 ), Unlink All, Link( {"key", "key"} ), Link( {"val", "val"} ) )) << Compare with( dtRestored );
Write( "\!n\!nData table on disk:\!n", Load Text File( "$temp/table.json" ) );
If( ok,
Write( "\!ntables match" ),
Write( "\!nhmmm, tables are different" )
);
with the associative array the lookups are simple:
type = restoredVariables["type"];
"favs"
Craige