I want to parse the keyValue Pair from the file without using the Class .
Basically what i want is :
Deserialize Json from file in C#
What I have tried:
MyOutput.json
{
"Platform Parent Dato Id": "23768",
"Platform Dato Id": "24138",
"Platform Dato Name": "Random Europe",
"Platform mission Id": "111112",
"Platform submission Id": "638687",
"Platform submission Flight Id": "863524",
"Start Date": "2017-12-01",
"End Date": "2017-12-02",
"Platform Compensation": 109.0909,
"Total Value": 909.0909,
"Goal": "200000.0000",
"Value Information": {
"Platform Compensation": [
{
"Platform mission Id": "111112",
"Platform submission Id": "638687",
"Platform submission Flight Id": "863524",
"Value Rate": "14.0000",
"Value": 109.0909
}
]
}
},
{
"Platform Parent Dato Id": "23768",
"Platform Dato Id": "24138",
"Platform Dato Name": "Random Europe",
"Platform mission Id": "111113",
"Platform submission Id": "638687",
"Platform submission Flight Id": "863524",
"Start Date": "2017-12-01",
"End Date": "2017-12-02",
"Platform Compensation": 109.0909,
"Total Value": 909.0909,
"Goal": "200000.0000",
"Value Information": {
"Platform Compensation": [
{
"Platform mission Id": "111113",
"Platform submission Id": "638687",
"Platform submission Flight Id": "863524",
"Value Rate": "12.0000",
"Value": 109.0909
}
]
}
}
<programs.cs>
static void Main(string[] args)
{
string jsonFilePath = @"Output.json";
string json = File.ReadAllText(jsonFilePath);
var dict = JsonConvert.DeserializeObject<Dictionary<string, Object>>(json);
foreach (var kv in dict)
{
Console.WriteLine(kv.Key + ":" + kv.Value);
}
}
I want to print Data like :(One case1)
Platform Parent Dato Id: 23768
Case2:
and I am using a NewtonJson in order to get the Value Rate from the Value Information nest.
Output Should be
Value Rate": 14.0000
Thanks for the advanced
Looking forward for your response