I have a JSON string
{
"F1":
{
"BF1":"BV1",
"BF2":"BV2"
},
"F2":"BF1"
}
and I wish to assign it to an object of this type
public class MyType
{
public string F1 {get;set;}
public string F2 {get;set;}
}
in other words, I need to convert JSON to an object, but the inner object is to be assigned as a JSON string
2
Answers
the simpliest way is
or if you don’t want indented formating
of if you like a hard way
or if you have many properties that should deserialize common way
Though the answer posted by @serge looks best to me. But I spent some time to resolve your issue and I ended up with the below code:
I hope it may help you some way.