All,
I have a 2 part question.
Part 1.
Let's say I have a JSON file of this kind:
[
{
"Cat1": {
"SubCat1": {
"Param1": "AA",
"Param2": "BB"
},
"SubCat2": {
"Param1": "AB",
"Param2": "BC"
}
},
"Cat2": {
"SubCat1": {
"Param1": "BA",
"Param2": "BC"
},
"SubCat2": {
"Param1": "CB",
"Param2": "BD"
}
}
}
]
How would I import it to JMP (using GUI or scripts) to get something like this:
So far I'm just getting bunch of columns and one row.
Part 2.
Now I need to convert JMP table to JSON file. Let's say I have a JMP file that looks like above. Simple saving it as JSON would lead to this:
[
{
"Category" : "Cat1",
"SubCategory" : "SubCat1",
"Parameter" : "Param1",
"Value" : "AA"
},
{
"Category" : "Cat1",
"SubCategory" : "SubCat1",
"Parameter" : "Param2",
"Value" : "BB"
},
{
"Category" : "Cat1",
"SubCategory" : "SubCat2",
"Parameter" : "Param1",
"Value" : "AB"
},
{
"Category" : "Cat1",
"SubCategory" : "SubCat2",
"Parameter" : "Param2",
"Value" : "BC"
},
{
"Category" : "Cat2",
"SubCategory" : "SubCat1",
"Parameter" : "Param1",
"Value" : "BA"
},
{
"Category" : "Cat2",
"SubCategory" : "SubCat1",
"Parameter" : "Param2",
"Value" : "BC"
},
{
"Category" : "Cat2",
"SubCategory" : "SubCat2",
"Parameter" : "Param1",
"Value" : "CB"
},
{
"Category" : "Cat2",
"SubCategory" : "SubCat2",
"Parameter" : "Param2",
"Value" : "BD"
}
]
Which is not good.
But if I construct an AA that looks like this and save it as JSON:
AA = [
"Cat1"=> [
"SubCat1"=> [
"Param1"=> "AA",
"Param2"=> "BB"
],
"SubCat2"=> [
"Param1"=> "AB",
"Param2"=> "BC"
]
],
"Cat2"=> [
"SubCat1"=> [
"Param1"=> "BA",
"Param2"=> "BC"
],
"SubCat2"=> [
"Param1"=> "CB",
"Param2"=> "BD"
]
]
];
JSON = As JSON Expr(AA);
Save Text File("C:\Users\MyUser\JMPtoJSON\AAtoJSON.json", JSON)
then I get JSON I need.
Question - what is the most efficient way of constructing AA like that from JMP table like that?
Thanks!