I want to make a formatted json file in C#.
I want to make like this:
{
"LiftPositioner" : [
"LiftMax" : 5,
"LiftMin" : 0
],
"Temperature" : [
"CH0_Temp" : 25,
"CH1_Temp" : 25
]
}
but the result was
{
"LiftMax": 5,
"LiftMin": 0,
"CH0_Temp": 25,
"CH1_Temp": 25
}
This is my code :
var json = new JObject();
json.Add("LiftMax", Convert.ToInt32(radTextBox_LiftMax.Text));
json.Add("LiftMin", Convert.ToInt32(radTextBox_LiftMin.Text));
json.Add("CH0_Temp", Convert.ToInt32(radTextBox_CH0.Text));
json.Add("CH1_Temp", Convert.ToInt32(radTextBox_CH1.Text));
string strJson = JsonConvert.SerializeObject(json, Formatting.Indented);
File.WriteAllText(@"ValueSetting.json", strJson);
What do I have to change in code?
LiftPositionerandTemperaturebe lists?