Home > Mobile >  Asp Net Core 3.1 write and read JSON
Asp Net Core 3.1 write and read JSON

Time:06-07

I want to write data to a json file and read the data. However, the data in my json file is dynamic and may vary. I do not know what to use for this. Can you help?

My Json file is as follows:

{
  "IpAddress": ".....",
  "Port": 5000,
  .....
  "tracks": {
    "audio1": "track1.mp3"
    "audio2": "track2.mp3"
    .....
  }
}

CodePudding user response:

Use Nuget package Newtonsoft.Json.

enter image description here

action:

public IActionResult Index5([FromBody]Object o)
        {
            return Ok(o);
         }

the result of Object o:

![strong text

  • Related