How to Parse JSON Data in C# - Coding Gems

Поділитися
Вставка
  • Опубліковано 8 вер 2024
  • In this Coding Gem, I will teach you how to easily serialize and de-serialize JSON data in C#!
    💻Code: github.com/Par...
    💻Learning C#: • Learning C#: Introduct...
    Join us:
    📺 / parametriccamp
    💬 / discord
    📷 / parametriccamp
    🐦 / parametriccamp
    💻github.com/Par...
    📷🕺 / garciadelcastillo
    🐦🕺 / garciadelcast

КОМЕНТАРІ • 28

  • @linusfahlander2449
    @linusfahlander2449 6 місяців тому +5

    Hours spent searching for good tutorials and i finaly find this channel. Amazing video!

  • @justfeeldbyrne2791
    @justfeeldbyrne2791 5 місяців тому +1

    Thank you for this video, this really helped me. I'm just starting out in C# and I'm sure what I was trying to do could be done a lot better, but this was the easiest for me to understand!

  • @tjlaser99
    @tjlaser99 10 місяців тому +2

    Never seen anyone so good at explaining!

  • @danpurdy32
    @danpurdy32 Рік тому +4

    fantastic! clear, concise, and extremely helpful. Thank you!

  • @seanrendall5495
    @seanrendall5495 2 місяці тому

    Super helpful. All I wish this included was how to get just a portion of the JSON file as a string.

  • @BF0001
    @BF0001 3 місяці тому

    FANTASTIC. Very well done and explained so clearly. 10/10

  • @idegarceus5895
    @idegarceus5895 2 дні тому

    Thank you! That was very helpful.

  • @mikelammi3088
    @mikelammi3088 2 місяці тому

    Thanks for your content! Clear and concise 👏

  • @thomaswoods1365
    @thomaswoods1365 Місяць тому

    This is awesome. Thank you! Thank you!

  • @gameofjoy3561
    @gameofjoy3561 Місяць тому

    Very nice video. You made it so easy. Thank you so much. 👍

  • @adyman0010
    @adyman0010 10 днів тому

    It would be also nice if you could show us how to write data into the .json file :)

  • @HaploBartow
    @HaploBartow 5 місяців тому +1

    This is a great video and very clear, but I would like to see how you handle this case but with multiple strings of the same format you've shown here. Do you have to create multiple lists? Or can you do it with a list of lists (e.g. nested)?

  • @StephenBeale
    @StephenBeale 11 днів тому

    Very useful, thanks - the only thing I would add is that I had access denied when trying to read in from a file (even when running VS 2022 as Administrator). Any tips on sorting that would be great (I'm on a work computer so it's hard to know what else might be going on in the background)

  • @markus72wi
    @markus72wi Рік тому

    Thanks for this clear tutorial , helped a lot

  • @alexsnowblind
    @alexsnowblind 6 місяців тому

    Thank you! Well explained!

  • @Za3DoRzX
    @Za3DoRzX 9 місяців тому

    Great explanation.

  • @ahmedadel2487
    @ahmedadel2487 10 місяців тому

    FANTASTIC VIDEO

  • @EmranSalah
    @EmranSalah 10 місяців тому

    Very helpful.
    Thank you very much

  • @mindblower113
    @mindblower113 10 місяців тому

    Nice video man thanks.

  • @gametech7725
    @gametech7725 11 місяців тому

    Amazing. How to enable Auto complete of visual studio? Can you guide please?

    • @tuomaslehtonen1707
      @tuomaslehtonen1707 11 місяців тому

      It is called IntelliSense. Should be under Tools -> Options -> Text Editor -> C# -> IntelliSense.

    • @gametech7725
      @gametech7725 11 місяців тому

      @@tuomaslehtonen1707 i cant find it under Tools. I have one in Visual studio -> Preference -> Text editor -> IntelliSense.
      It’s enable but not working like shown in your video.
      Didn’t saw anything related to C# in above path although I’m working with Unity & C#. Maybe a module is missing? 🤔

  • @peremos7781
    @peremos7781 5 місяців тому

    How to deserialize this Json, what to do with the word "producto" before the properties?
    {
    "producto": {
    "iDpRODUCTO": 6,
    "codigoBarra": 54323,
    "nombre": "cera",
    "marca": "avon",
    "categoria": "belleza",
    "precio": 3400
    }
    }

  • @nearissad3127
    @nearissad3127 9 місяців тому

    oh my god thank you

  • @athanasmb
    @athanasmb Рік тому

    thansk!!

  • @netrunner1987
    @netrunner1987 29 днів тому

    Ran into this early morning, helped me a bunch. Kinda stuck now, what do you do when you have "location": null? When I deserialize and try to read root.data.location, I get a System.NullReferenceException: 'Object reference not set to an instance of an object.'
    Document_Parser.readjson.Data.dateOfBirth.get returned null.
    Thanks

  • @kvelez
    @kvelez 9 місяців тому +1

    using ConsoleApp1;
    using System.Text.Json;
    var person = new Person("Kevin", 19);
    var _serializeJSON = JsonSerializer.Serialize(person);
    File.WriteAllText("file.json", _serializeJSON);
    var readJSON = File.ReadAllText("file.json");
    Person _deserialize = JsonSerializer.Deserialize(readJSON);
    Console.WriteLine($"{_deserialize.Name} is {_deserialize.Age} years old.");
    Console.ReadKey();