I use PowerShell to parse the JSON file with array objects. My JSON file is like:
File Test.json
{
"My Test Plan A": {
"VariableA":"A",
"VariableB":"B",
"VariableC":"C",
"VariableD":"D"
},
"My Test Plan B": {
"VariableA":"E",
"VariableB":"F",
"VariableC":"G",
"VariableD":"H"
}
}
As you can see, there are two objects, My Test Plan A and My Test Plan B in my JSON file. And each object has the same variable name, but their values are different.
When the name of the array object is given, how can I get the variables of the corresponding array, so that I can get all the variables in the array for the next code to use?
After obtaining the corresponding array variable, how can the expression to obtain it in the following code be, like $(VariableA)?
Note:
The JSON file is written by myself. If it is not suitable, please modify it directly.