{"id":15041108,"url":"https://github.com/khelechy/csjsondb","last_synced_at":"2025-04-14T19:36:33.780Z","repository":{"id":49636306,"uuid":"374657826","full_name":"Khelechy/CSJsonDB","owner":"Khelechy","description":"A C# package that performs basic CRUD ( Create, Read, Update, Delete ) operations on a Json file, used for sample minimalistic DBs.","archived":false,"fork":false,"pushed_at":"2021-06-21T10:13:26.000Z","size":119,"stargazers_count":81,"open_issues_count":1,"forks_count":13,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-28T08:01:46.642Z","etag":null,"topics":["crud","csharp","csharp-library","database","db","dotnet","dotnet-core","nuget"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Khelechy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-07T12:28:31.000Z","updated_at":"2024-07-03T15:40:18.000Z","dependencies_parsed_at":"2022-09-12T21:20:36.273Z","dependency_job_id":null,"html_url":"https://github.com/Khelechy/CSJsonDB","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Khelechy%2FCSJsonDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Khelechy%2FCSJsonDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Khelechy%2FCSJsonDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Khelechy%2FCSJsonDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Khelechy","download_url":"https://codeload.github.com/Khelechy/CSJsonDB/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248946876,"owners_count":21187588,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["crud","csharp","csharp-library","database","db","dotnet","dotnet-core","nuget"],"created_at":"2024-09-24T20:45:33.654Z","updated_at":"2025-04-14T19:36:33.756Z","avatar_url":"https://github.com/Khelechy.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSJsonDB\n## Introduction\n\nThis is a simple C# package that performs basic CRUD ( Create, Read, Update, Delete ) operations on a Json file, used for sample minimalistic DBs.\n\n## Installation\n\nInstall via .NET CLI\n\n```bash\ndotnet add package CSJsonDB --version 1.1.0\n```\nInstall via Package Manager\n\n```bash\nInstall-Package CSJsonDB --version 1.1.0\n```\n\n### Add the namespace directive `using CSJsonDB;`  `IMPORTANT`\n\nSample DB `users.db`\n\n```json\n{\n    \"users\": [\n      {\n        \"id\": 1,\n        \"firstname\": \"kelechi\",\n        \"lastname\": \"onyekwere\",\n        \"age\": 19,\n        \"verified\": true\n      },\n      {\n        \"id\": 2,\n        \"firstname\": \"john\",\n        \"lastname\": \"doe\",\n        \"age\": 33,\n        \"verified\": true\n      },\n      {\n        \"id\": 3,\n        \"firstname\": \"mark\",\n        \"lastname\": \"parker\",\n        \"age\": 20,\n        \"verified\": false\n      }\n    ]\n  }\n  ```\n\n### Load the Sample DB `IMPORTANT`\n\n```c#\nvar db = JsonDB.Load(\"filepathtosampledb/users.db\");\n```\n\n## Available Methods 🧨\n\n\u003e**NOTE**\u003c/br\u003e\n\u003eResponses are returned as objects. You can use `.ToJsonString()` method to return json string from a json object\n\n### Load\n\n```c#\nvar db = JsonDB.Load(string filePath);\n```\n\n\n### ToJsonString\n\n```c#\ndb.Select(\"users\").Where(\"id\", 2).ToJsonString();\n```\nresult: `string` Returns the json string of the object.\n\n### Select\n\n```c#\ndb.Select(string table);\n```\n\n#### Sample \n```c#\ndb.Select(\"users\");\n```\nresult: `object`\n```json\n[\n      {\n        \"id\": 1,\n        \"firstname\": \"kelechi\",\n        \"lastname\": \"onyekwere\",\n        \"age\": 19,\n        \"verified\": true\n      },\n      {\n        \"id\": 2,\n        \"firstname\": \"john\",\n        \"lastname\": \"doe\",\n        \"age\": 33,\n        \"verified\": true\n      },\n      {\n        \"id\": 3,\n        \"firstname\": \"mark\",\n        \"lastname\": \"parker\",\n        \"age\": 20,\n        \"verified\": false\n      }\n]\n```\n\n### Where\n```c#\ndb.Select(string table).Where(string key, dynamic value);\n```\n#### Sample\n```c#\ndb.Select(\"users\").Where(\"id\", 2);\n```\nresult: `List\u003cdynamic\u003e`\n```json\n[\n      {\n        \"id\": 2,\n        \"firstname\": \"john\",\n        \"lastname\": \"doe\",\n        \"age\": 33,\n        \"verified\": true\n      },\n]\n```\n\n### Add\n```c#\ndb.Add(string table, object newData);\n```\n#### Sample\n```c#\nvar newUser = new {\n    id = 3,\n    firstname = matt,\n    lastname = doe,\n    age = 23,\n    verified = false\n};\n\ndb.Add(\"users\", newUser);\n```\nresult: void\n\n### Delete\n```c#\ndb.Delete(string table, string key, dynamic value);\n```\n#### Sample\n```c#\ndb.Delete(\"users\", \"id\", 1);\n```\nresult: void\n\n### Update\n```c#\ndb.Update(string table, string key, dynamic value, object newData);\n```\n#### Sample\n```c#\nvar updateUser = new {\n    verified = true\n};\n\ndb.Update(\"users\", \"id\", 3, updateUser);\n```\nresult: `object`\n```json\n[\n      {\n        \"id\": 3,\n        \"firstname\": \"mark\",\n        \"lastname\": \"parker\",\n        \"age\": 20,\n        \"verified\": true\n      },\n]\n```\n\n\n## Contribution\n\nIf you find an issue with this package or you have any suggestion please help out. I am not perfect.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhelechy%2Fcsjsondb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhelechy%2Fcsjsondb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhelechy%2Fcsjsondb/lists"}