Asem Alwadi

Asem Alwadi

  • 1.7k
  • 14
  • 410

return Json with value only two brackets id there no data

Nov 20 2023 5:30 AM

hi ,

i have web api in asp.net c# should return json format like this :

{

"evidence": {

"file":"JVBERi0xLjQNCjEgMCBvYmoNCjw8DQovQ3JlYXRvciAoT3JhY2xlMTFnUjEgQVMgUmVwb3J0cyBTZXJ2aWNlcykNCi9DcmVhdG",

fileType:"pdf"}
        }

}

but in some cases i need to return the same object with only two brackets this the requirment like this:

{

"evidence": {}

}

model class structure :

public class evidenceObj
        {

            public string file { get; set; }
            public string fileType { get; set; }
        }

 

 

can any one help me i tried too much but couldnt find result 

thank you


Answers (1)