{"id":20409361,"url":"https://github.com/jsakamoto/dictionarystringobjectjsonconverter","last_synced_at":"2026-02-22T13:02:51.532Z","repository":{"id":65386914,"uuid":"535652061","full_name":"jsakamoto/DictionaryStringObjectJsonConverter","owner":"jsakamoto","description":"A converter for System.Text.Json to deserialize a JSON string into a Dictionary\u003cstring, object\u003e object as humans would expect.","archived":false,"fork":false,"pushed_at":"2022-09-12T13:15:31.000Z","size":26,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-01T02:01:00.001Z","etag":null,"topics":["converter","json"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsakamoto.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":"2022-09-12T12:18:12.000Z","updated_at":"2024-05-20T05:51:27.000Z","dependencies_parsed_at":"2023-01-21T13:17:55.649Z","dependency_job_id":null,"html_url":"https://github.com/jsakamoto/DictionaryStringObjectJsonConverter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jsakamoto/DictionaryStringObjectJsonConverter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsakamoto%2FDictionaryStringObjectJsonConverter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsakamoto%2FDictionaryStringObjectJsonConverter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsakamoto%2FDictionaryStringObjectJsonConverter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsakamoto%2FDictionaryStringObjectJsonConverter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsakamoto","download_url":"https://codeload.github.com/jsakamoto/DictionaryStringObjectJsonConverter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsakamoto%2FDictionaryStringObjectJsonConverter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270034291,"owners_count":24515664,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"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":["converter","json"],"created_at":"2024-11-15T05:41:10.959Z","updated_at":"2025-10-03T14:24:36.570Z","avatar_url":"https://github.com/jsakamoto.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DictionaryStringObjectJsonConverter [![NuGet Package](https://img.shields.io/nuget/v/Toolbelt.Text.Json.Serialization.DictionaryStringObjectJsonConverter.svg)](https://www.nuget.org/packages/Toolbelt.Text.Json.Serialization.DictionaryStringObjectJsonConverter/) [![unit tests](https://github.com/jsakamoto/DictionaryStringObjectJsonConverter/actions/workflows/unit-tests.yml/badge.svg?branch=main\u0026event=push)](https://github.com/jsakamoto/DictionaryStringObjectJsonConverter/actions/workflows/unit-tests.yml)\n\n## Summary\n\nThis is an attribute and a converter on the `System.Text.Json` infrastructure to deserialize a JSON string to a `Dictionary\u003cstring, object\u003e` object with each value of appropriate basic type, not `System.Text.JsonElement`.\n\n## Usage\n\n1. Add the `Toolbelt.Text.Json.Serialization.DictionaryStringObjectJsonConverter` NuGet package to your .NET project.\n\n```shell\ndotnet add package Toolbelt.Text.Json.Serialization.DictionaryStringObjectJsonConverter\n```\n\n2. Add the `[DictionaryStringObjectJsonConverter]` attribute to a property of the `Dictionary\u003cstring, object\u003e` type.\n\n```csharp\nusing Toolbelt.Text.Json.Serialization;\n\npublic class MyType\n{\n    [DictionaryStringObjectJsonConverter]\n    public Dictionary\u003cstring, object?\u003e Items { get; set; } = new();\n}\n```\n\n3. You can deserialize a JSON string to an object of the `Dictionary\u003cstring, object\u003e` type.\n\n```csharp\nusing System.Text.Json;\n\nvar json = @\"{\\\"items\\\": {\n    \\\"Lorem\\\": 1,\n    \\\"ipsum\\\": \\\"Two\\\", \n    \\\"amets\\\": [3.4, 5.6],\n    \\\"dolor\\\": true\n  }\n}\";\n\nvar obj = JsonSerializer.Deserialize\u003cMyType\u003e(json);\nobj.Items[\"Lorem\"]; // -\u003e 1, typeof(int)\nobj.Items[\"ipsum\"]; // -\u003e \"Two\", typeof(string)\nobj.Items[\"amets\"]; // -\u003e new[]{ 3.4, 5.6 }, typeof(double[])\nobj.Items[\"dolor\"]; // -\u003e true, typeof(bool)\n```\n\nIf you didn't add the `[DictionaryStringObjectJsonConverter]` attribute to a property of the `Dictionary\u003cstring, object\u003e` type, you would get all of the values in that dictionary object as the `System.Text.JsonElement` struct value instead of an appropriate basic type value of the .NET.\n\n## License\n\n[Mozilla Public License, version 2.0](https://github.com/jsakamoto/DictionaryStringObjectJsonConverter/blob/main/LICENSE)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsakamoto%2Fdictionarystringobjectjsonconverter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsakamoto%2Fdictionarystringobjectjsonconverter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsakamoto%2Fdictionarystringobjectjsonconverter/lists"}