here is my jason text file containing more than two json object having different policyNumber i want to read data on the base of policyNumber or may be another value and it show only those json object having same parameters that i request or say same policy number i sent to them. I am working on API so i have no idea about this and i am also fresher in it field no idea about how to return values. plese guide and thanks in advance my jason text file contain
{
"jsonData": {
"PolicyValue": {
"PolicyNumber": "003",
"EffectiveDate": "2022-09-14",
"MCV_NetBaseCashValue": 9700,
"Dividend": 0,
"DividendsInterest": 0,
"CouponBalance": 0,
"CouponBalancesInterest": 0,
"BaseCashValue": 700,
"CashSurrenderValue": 00,
"APLAmount": 0,
"APLAmountsInterest": 0,
"OPLAmount": 0,
"OPLAmountsInterest": 0,
"MiscellaneousSuspense": 0,
"PremiumSuspense": 0,
"OutstandingDisbursement": 0,
"SurrenderCharge": 0
}
},
"reponseCode": "00",
"reponseMessage": ""
}
{
"jsonData": {
"PolicyValue": {
"PolicyNumber": "123",
"EffectiveDate": "2022-08-17",
"MCV_NetBaseCashValue": -100,
"Dividend": 0,
"DividendsInterest": 0,
"CouponBalance": 0,
"CouponBalancesInterest": 0,
"BaseCashValue": 100,
"CashSurrenderValue": -100,
"APLAmount": 0,
"APLAmountsInterest": 0,
"OPLAmount": 0,
"OPLAmountsInterest": 0,
"MiscellaneousSuspense": 0,
"PremiumSuspense": 0,
"OutstandingDisbursement": 0,
"SurrenderCharge": 200
}
},
"reponseCode": "00",
"reponseMessage": ""
}
this is my first file and my second file is
{
"jsonData": {
"PolicyNumber": "354",
"PolicyCommencementDate": "2020-07-31",
"InsuranceDetails": [ {
"PolicyNumber": "54",
"ClientID": "04",
"InsuredFirstName": "LEÄ",
"InsuredLastName": "HAÈNG",
"InsuredDOB": "1978-01-01"
},
{
"PolicyNumber": "54",
"ClientID": "09",
"InsuredFirstName": " YEÂN",
"InsuredLastName": "NG",
"InsuredDOB": "2006-11-08"
} ]
},
"reponseCode": "00", "reponseMessage": ""
}
{
"jsonData": {
"PolicyNumber": "737",
"PolicyCommencementDate": "2019-07-25",
"InsuranceDetails": [
{
"PolicyNumber": "37",
"ClientID": "15",
"InsuredFirstName": "N HAÛI",
"InsuredLastName": "ANH",
"InsuredDOB": "1989-10-04"
},
{
"PolicyNumber": "37",
"ClientID": "25",
"InsuredFirstName": "NH",
"InsuredLastName": "AÁN",
"InsuredDOB": "1988-01-04"
},
{
"PolicyNumber": "37",
"ClientID": "26",
"InsuredFirstName": "RUÙC",
"InsuredLastName": "DNG",
"InsuredDOB": "2021-05-17"
}
]
},
"reponseCode": "00",
"reponseMessage": ""
}
i want to apply on the base of get request please solve this issue as soon as possible
i teried this code in my value controller
public class ValuesController : ApiController
{
string[] fileConten = Directory.GetFiles(HostingEnvironment.MapPath(@"~/Documents/V1/policy/seachpolicy"));
public string Get()
{
string writeResult = string.Empty;
string strr = File.ReadAllText(fileConten[2]);
JObject jsonObj = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(strr);
var jobj = JObject.Parse(jsonObj.ToString());
foreach (var item in jobj.Properties())
{
item.Value = item.Value["PolicyNumber"].ToString();
//item.Value = item.Value.SelectToken["PolicyValue"][0]["PolicyNumber"].ToString();
//item.Value = item.Value["PolicyNumber"][0]["InsuranceDetails"]["InsuredFirstName"].ToString();
int nm = Convert.ToInt32(item.Value);
if (nm == 008019354)
{
writeResult = jobj.ToString();
break;
}
break;
//item.Value = item.Value.ToString().Replace("0", "1");
}
return writeResult;
string output = Newtonsoft.Json.JsonConvert.SerializeObject(jsonObj, Newtonsoft.Json.Formatting.Indented);
return output;
this code not work properly
}