Click here to Skip to main content
15,881,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear All,

I am Sending request from json to my wcf service.For Mapping Key value in wcf i have created class and property in that.In Json request there is Key name is ScoreCard.Inside that key there is multiple key and value which is dynamic.

So when i request send to wcf i got it all the keys value except ScoreCard key which is dynamic.I also google it above issue but i get only static key solution not a dynamic.Pls help me to solved issue.

Below are the Json Request and WCF Property Value.

C#
{"ProspectNo":"1000000073","MakerId":"C136771","MkrDate":"2015/11/26","TranID":"1","ScoreData":{"Client Experience":"1","Stability & Ownership":"7","Property ownership":"22","Co-app/Guarantor":"16","proposed cost":"1800000"}}

Class Declare in WCF.
public class Score
{
 
    [DataMember()]
    public string ProspectNo;
 
    [DataMember()]
    public string MakerId;
 
    [DataMember()]
    public string MkrDate;
 
  
    [DataMember()]
    public string TranID;
 
    [DataMember()]
   public string  ScoreData;

Below is value get when send request to wcf.
MakerId = "C136771"
MkrDate = "2015/11/26"
ProspectNo = "1000000073"
TranID = "1"
ScoreData = Null

}



Thanks,
Manohar
Posted
Comments
Nathan Minier 17-Dec-15 8:36am    
As noted when you posted this yesterday, the data type on ScoreData should really be object to deserialize correctly.

To use it, use:
dynamic scoreInstance = <deserializedscore> as dynamic;
scoreInstance.whatever;

Or if you need to enumerate it, use reflection.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900