-4

i have this json with data

http://84.235.49.85:58/saws/hi/is/inserSer?jsonObject={
    "authObject":{
        "userName":"7070",
        "password":"123",
        "baladyCode":"07",
        "amanaCode":"061"
        },
    "billObj":{
        "billNumber":"0611138000302",
        "billCreationDate":"07-01-1438",
        "billDetails":[
                {"depId":"11006","billValue":"1"}
        ]}
}

authObject Obj:- this object holds authentication data about user that will be used to decide can we allow accessing for this request or not.

billObj Obj:- this object holds bill data that will be used to create insertion operation, let us say that every bill may have one sub-account or many sub-accounts so we make it dynamic and give you to create Json Array of bill's details that holds every sub-account and its value

any one help me for creating this code in c# form . i need full code for this example please .thanks

  • 1
    Visual Studio has a paste special feature that can make the model for you. under the 'Edit' menu. Deserialization can be done with Json.Net – robjam Jun 02 '17 at 01:33

1 Answers1

1

You must use a library for that.

I recommend you Newtonsoft.JSON

It's easy to use, and you can download it via nuget.

You must create a class and just fun!

ej: https://pastebin.com/6sVd1TF0
  • "must" is way too strong statement. There are several classes in .Net framework itself for example that can deserialize JSON... One can even write correct parser themselves... (Note that there is no point to post such answer as such broad "how to read JSON" question already answered many times on SO). – Alexei Levenkov Jun 02 '17 at 02:04
  • Ruben Lopez : I test the code but give me the this error at response recodeAn unhandled exception of type 'Newtonsoft.Json.JsonReaderException' occurred in Newtonsoft.Json.dll Additional information: Unexpected character encountered while parsing value: ط. Path '', line 0, position 0. – Gehad Alhariri Jun 02 '17 at 02:45