Answer the question
In order to leave comments, you need to log in
How to generate json like this?
Hello everyone, I was faced with the task of generating json in the following format:
{
"#DATE#": {
"#TIME#": {
"FREE": "#FREE_VALUE#",
"PRICE": "PRICE_VALUE"
},
...
"#TIME#": {
"FREE": "#FREE_VALUE#",
"PRICE": "PRICE_VALUE"
}
},
...
"#DATE#": {
"#TIME#": {
"FREE": "#FREE_VALUE#",
"PRICE": "PRICE_VALUE"
},
...
"#TIME#": {
"FREE": "#FREE_VALUE#",
"PRICE": "PRICE_VALUE"
}
}
}
{
"08.03.2017": {
"01:30":{
"FREE":true,
"PRICE":3500
},
"18:00":{
"FREE":true,
"PRICE":3500
},
"21:00":{
"FREE":false,
"PRICE":3500
}
},
"09.03.2017": {
"01:30":{
"FREE":true,
"PRICE":3500
},
"18:00":{
"FREE":true,
"PRICE":3500
},
"21:00":{
"FREE":false,
"PRICE":3500
}
},
"10.03.2017": {
"01:30":{
"FREE":true,
"PRICE":3500
},
"18:00":{
"FREE":true,
"PRICE":3500
},
"21:00":{
"FREE":false,
"PRICE":3500
}
}
}
Answer the question
In order to leave comments, you need to log in
I think that dictionaries (Dictionary) are ideal for you
https://www.newtonsoft.com/json/help/html/Serializ...
Something like:
Dictionary<string, Dictionary<string, SomeObject>> a;
a["10.03.2017"]["01:30"] = new SomeObject{FREE = true, PRICE=1234}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question