I have a JObject:
{
"config": {
"DataSource": {
"connectionString": "Localserver",
"sqlExpression": "select id As 'key', logHeader As 'Label' from Log"
}
}
}
How can I get the value of connectionString
and sqlExpression
?
I am trying:
JObject result = new JObject(
data["DataSource"]
.SelectMany(jt => jt["properties"]));
string connectionString = result.GetValue("connectionString").ToString();
string sqlExpression = result.GetValue("sqlExpression").ToString();
However, I'm not getting the results. Any suggestions?