Ashok
Ashok

Reputation: 11

how to deserialize this json code and store it in sql

 {
     "payload": {
         "coordinators": [
             {
                 "coordinatorID": "1",
                 "remarks": "a",
                 "briefObservation": "a",
                 "justifyingRecommendation": "a",
                 "sectors": [
                     {
                         "sectorNumber": "8",
                         "projectDescription": "a",
                         "knowledgeMarks": "a",
                         "siteMarks": "a",
                         "impactAccessmentMarks": "a",
                         "empAddressingMarks": "a",
                         "totalMarks": "a",
                         "recommendation": "a",
                         "category": "a"
                     },
                     {
                         "sectorNumber": "10",
                         "projectDescription": "a",
                         "knowledgeMarks": "a",
                         "siteMarks": "a",
                         "impactAccessmentMarks": "a",
                         "empAddressingMarks": "a",
                         "totalMarks": "a",
                         "recommendation": "a",
                         "category": "a"
                     }
                 ]
             }
         ]
     },
     "status": 0,
     "message": "Success/Fail Reason"
 }

Upvotes: 1

Views: 2225

Answers (2)

You have an article that could be useful here to deserialize json with c#:

To save an object to a database, you can have a look to this documentation.

Upvotes: 1

cjuette
cjuette

Reputation: 31

Json.NET is your friend. You can find examples directly in the documentation.

http://www.newtonsoft.com/json/help/html/SerializingJSON.htm

"Store it in SQL" is a bit generic. Without knowing the database in question or more of the implementation target than the tag "C#" I can only guess. Here comes another link to a Youtube video tutorial - connecting to a MySQL db and inserting data with C#.

https://www.youtube.com/watch?v=U3bVc7E6UHA

Upvotes: 2

Related Questions