I'm making a simple MP3 player for one of my first C# projects, and every time you play a song I want it to save to a JSON so you can see the songs that you've recently listened to. I want it to load the JSON every time you open it and put the names of mp3s you've listened to inside a list (I'm using VS). It seems simple but I'm not very experienced with C# yet and I was wondering how I could do this?
2 Answers
There are a lot of ways to do this and they all have pros/cons depending on your system. I can't say which is the best fit for you but I would start by looking into some of the C#/.NET JSON libraries because they will do a lot of the heavy lifting for you,
https://www.newtonsoft.com/json
And here is a similar question with some answers you might find helpful,
How to write a JSON file in C#?
You might also want to look into document-based databases. MongoDB, Firestore, etc. They are all collections of documents (often JSON or something very similar) to store your data with APIs for reading and writing. A document-based database would be a good option if you wanted your user's 'Recently played' to work across multiple devices, since these options would store your data remotely.

- 600
- 1
- 6
- 15
First of all welcome to amazing world of C#. If you just learning try saving to a json file and reading from one. this post will give you an idea :
How to write a JSON file in C#?
once you get comfortable with that you can try storing in the database as mentioned by DKidwell or something like https://www.npmjs.com/package/json-server

- 76
- 7