Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to desgin class structure while using JsonConvert.DeserializeObject

I want to import some data from a json file to a class, it’s very clear in PHP but in ASP.net I really don’t know how to desgin the class structure while I trying to use JsonConvert.DeserializeObject() to deserialize the json string.
Here is my json string:

{
    "video": {
        "path": {
            "source": "d:/videos/",
            "temp": "d:/temp/",
            "dest": "d:/dest/videos/"
        },
        "allowExt": ["avi", "mp4"],
        "bitrate": "1600"
    },
    "photo": {
        "path": {
            "source": "d:/photos/",
            "temp": "d:/temp/",
            "dest": "d:/dest/photoss/"
        },
        "allowExt": ["jpg", "png"],
        "quality": "80"
    }
}

Thank you very much.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

There is a lot of online tools for creating models and mappings from json to (almost any language)

The one that suits your needs: https://json2csharp.com/

(Just copy-paste your json to left textarea, click "Convert", be happy)

Another good one is: https://app.quicktype.io/ but it uses Newtonsoft.Json

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading