{"id":50333052,"url":"https://github.com/kernix13/csharp-jsonserializer-example","last_synced_at":"2026-05-29T11:01:32.331Z","repository":{"id":357477986,"uuid":"1237065125","full_name":"Kernix13/csharp-JsonSerializer-example","owner":"Kernix13","description":"C# Object Oriented Programming example that uses the JsonSerializer class for creating JSON data.","archived":false,"fork":false,"pushed_at":"2026-05-12T23:25:24.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-13T01:30:19.913Z","etag":null,"topics":["csharp","json","oop"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kernix13.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-12T20:58:04.000Z","updated_at":"2026-05-12T23:25:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Kernix13/csharp-JsonSerializer-example","commit_stats":null,"previous_names":["kernix13/csharp-jsonserializer-example"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Kernix13/csharp-JsonSerializer-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kernix13%2Fcsharp-JsonSerializer-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kernix13%2Fcsharp-JsonSerializer-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kernix13%2Fcsharp-JsonSerializer-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kernix13%2Fcsharp-JsonSerializer-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kernix13","download_url":"https://codeload.github.com/Kernix13/csharp-JsonSerializer-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kernix13%2Fcsharp-JsonSerializer-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33648534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-29T02:00:06.066Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","json","oop"],"created_at":"2026-05-29T11:01:28.692Z","updated_at":"2026-05-29T11:01:32.326Z","avatar_url":"https://github.com/Kernix13.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSharp OOP using Interfaces and JsonSerializer\n\nThis project uses an interface and 3 classes to create user objects, then uses `JsonSerializer` and the `Serialize` method with `JsonSerializerOptions` to create a JSON file of the objects.\n\nThere is one main class `NewUser` that implements the `IUser` interface. I intend create other classes such as AdminUser, GuestUser, etc.\n\n\u003e The is the final deliverable for module 2 (week 5) of the C# Software Development pathway for [Code:You](https://code-you.org/).\n\n\u003c!--\n  Repo name: csharp-JsonSerializer-example\n  Project folder name: JsonOOP\n  About text: C# Object Oriented Programming example that uses the JsonSerializer class for creating JSON data.\n\n  1. Consumes a JSON file that contains at least one array of object values\n     - I created a json file, I did not \"consume\"\n  2. Iterates over that array of objects and displays the contents of those objects\n     - I iterate over the users using _users which are objects\n --\u003e\n\n\u003cspan aria-hidden=\"true\"\u003e\u003cbr\u003e\u003c/span\u003e\n\n## Installation \u0026 Usage\n\n1. Clone this repository and switch into project folder\n\n   ```sh\n   git clone https://github.com/Kernix13/csharp-JsonSerializer-example.git JsonOOP\n   cd JsonOOP\n   ```\n\n2. Run the application\n\n   ```bash\n   dotnet run\n   ```\n\n3. Build the application\n\n   ```bash\n   dotnet build\n   ```\n\n### Quick Start\n\n```sh\ngit clone https://github.com/Kernix13/csharp-JsonSerializer-example.git JsonOOP\ncd JsonOOP\ndotnet run\n```\n\n### Example JSON\n\nI used `users.json` from [{JSON} Placeholder](https://jsonplaceholder.typicode.com/) as sample JSON for my objects, though I did not include every field. Here is an example:\n\n```json\n{\n   \"id\": 1,\n   \"name\": \"Leanne Graham\",\n   \"username\": \"Bret\",\n   \"email\": \"Sincere@april.biz\",\n   \"address\": {\n      \"street\": \"Kulas Light\",\n      \"suite\": \"Apt. 556\",\n      \"city\": \"Gwenborough\",\n      \"zipcode\": \"92998-3874\",\n   }\n},\n```\n\n\u003cspan aria-hidden=\"true\"\u003e\u003cbr\u003e\u003c/span\u003e\n\n## Code to use in this project\n\n### Module 2 code I want to include\n\n| Code to use                | Used? |\n| :------------------------- | :---: |\n| System.IO                  |  ✅   |\n| System.Text.Json           |  ✅   |\n| Interface                  |  ✅   |\n| Class                      |  ✅   |\n| Instance constructors      |  ✅   |\n| Class methods              |  ✅   |\n| public keyword             |  ✅   |\n| private keyword            |  ✅   |\n| Path.Combine               |  ✅   |\n| Path.GetDirectoryName      |  📌   |\n| Directory.Exists           |  ✅   |\n| Directory.CreateDirectory  |  ✅   |\n| Directory.EnumerateFiles   |  📌   |\n| File.WriteAllText          |  ✅   |\n| JsonSerializer.Serialize   |  ✅   |\n| JsonSerializer.Deserialize |  ✅   |\n| JsonSerializerOptions      |  ✅   |\n| cast using `is` keyword    |  ✅   |\n| `new List\u003ctype\u003e`           |  ✅   |\n| `IEnumerable\u003cType\u003e`        |  📌   |\n| try/catch                  |  📌   |\n| -- throw new Exception     |  📌   |\n| -- ex.Message              |  📌   |\n\nConsider `StreamReader` and `StreamWriter` classes to maybe create a .csv file. I just do not know why I would do that if I am creating a users.json file. `StreamReader` will give me the opportunity to use a `while` loop which seems to always be used with that class.\n\nI do not understand the lesson on `JsonSerializer.Deserialize` though I think it is vital to implement for for a full CRUD app. I plan to add it so that I can enable deleting and updating user objects.\n\n### Module 1 code I want to include\n\n| Code to use         | Used? |\n| :------------------ | :---: |\n| foreach             |  ✅   |\n| while/do-while loop |  📌   |\n| Split               |  📌   |\n| ToUpper             |  ✅   |\n| Add                 |  ✅   |\n| IndexOf             |  📌   |\n| =\u003e                  |  ✅   |\n| ? :                 |  📌   |\n| !, !=, \\|\\|         |  📌   |\n\n- I will use foreach with maybe IEnumerable and Directory.EnumerateFiles but I will need a folder with multiple files in it?!?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkernix13%2Fcsharp-jsonserializer-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkernix13%2Fcsharp-jsonserializer-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkernix13%2Fcsharp-jsonserializer-example/lists"}