{"id":24424020,"url":"https://github.com/yutopp/vjson","last_synced_at":"2025-04-12T07:51:20.766Z","repository":{"id":34180074,"uuid":"169280010","full_name":"yutopp/VJson","owner":"yutopp","description":"A JSON serializer/deserializer (with JsonSchema support) library written in pure C#","archived":false,"fork":false,"pushed_at":"2022-11-14T05:23:20.000Z","size":305,"stargazers_count":16,"open_issues_count":6,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T03:04:35.622Z","etag":null,"topics":["csharp","json","json-schema","serialization","unity"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yutopp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE_1_0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-05T17:16:01.000Z","updated_at":"2023-09-07T11:34:53.000Z","dependencies_parsed_at":"2023-01-15T05:07:04.438Z","dependency_job_id":null,"html_url":"https://github.com/yutopp/VJson","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yutopp%2FVJson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yutopp%2FVJson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yutopp%2FVJson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yutopp%2FVJson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yutopp","download_url":"https://codeload.github.com/yutopp/VJson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248537003,"owners_count":21120688,"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":["csharp","json","json-schema","serialization","unity"],"created_at":"2025-01-20T10:48:51.764Z","updated_at":"2025-04-12T07:51:20.729Z","avatar_url":"https://github.com/yutopp.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VJson 🍣\n\n\u003e A JSON serializer/deserializer (with JsonSchema support) library written in pure C#.\n\n[![ci](https://github.com/yutopp/VJson/actions/workflows/ci.yml/badge.svg)](https://github.com/yutopp/VJson/actions/workflows/ci.yml)\n[![npm](https://img.shields.io/npm/v/net.yutopp.vjson)](https://www.npmjs.com/package/net.yutopp.vjson)\n[![NuGet Badge](https://buildstats.info/nuget/vjson)](https://www.nuget.org/packages/VJson/)\n[![codecov](https://codecov.io/gh/yutopp/VJson/branch/master/graph/badge.svg)](https://codecov.io/gh/yutopp/VJson)\n[![license](https://img.shields.io/github/license/yutopp/VJson.svg)](https://github.com/yutopp/VJson/blob/master/LICENSE_1_0.txt)\n\n`VJson` is a JSON serializer/deserializer (with JsonSchema support) library written in pure C#. Supported versions are `.NET Standard 2.0` or higher.  \nThis library is developed as a purely C# project, however it also supports that be build with `Unity 2019.4.22f1` or higher.\n\n## Installation\n\n### For standard C# projects\n\nYou can use [Nuget/VJson](https://www.nuget.org/packages/VJson/).\n\n```bash\ndotnet add package VJson\n```\n\n### For Unity projects\n\n#### stable\n\nAdd scoped registry information shown below to your `Packages/manifest.json` if not exists.\n\n```json\n{\n  \"scopedRegistries\": [\n    {\n      \"name\": \"yutopp.net\",\n      \"url\": \"https://registry.npmjs.com\",\n      \"scopes\": [\n        \"net.yutopp\"\n      ]\n    }\n  ]\n}\n```\n\nAnd add `net.yutopp.vjson` to your `Packages/manifest.json` like below.\n\n```json\n{\n  \"dependencies\": {\n    \"net.yutopp.vjson\": \"*\"\n  }\n}\n```\n\n#### nightly\n\nAdd a url for VJson git repository to your `Packages/manifest.json` like below.\n\n```json\n{\n  \"dependencies\": {\n    \"net.yutopp.vjson\": \"https://github.com/yutopp/VJson.git?path=Packages/net.yutopp.vjson\"\n  }\n}\n```\n\n(TODO: Provide unity packages)\n\n## Usage example\n\n### Serialize/Deserialize\n\n```csharp\n//\n// For serialization\n//\nvar serializer = new VJson.JsonSerializer(typeof(int));\n\n// You can get JSON strings,\nvar json = serializer.Serialize(42);\n\n// OR write json data(UTF-8) to streams directly.\nusing (var s = new MemoryStream())\n{\n    serializer.Serialize(s, 42);\n}\n```\n\n```csharp\n//\n// For deserialization\n//\nvar serializer = new VJson.JsonSerializer(typeof(int));\n\n// You can get Object from strings,\nvar value = serializer.Deserialize(json);\n\n// OR read json data(UTF-8) from streams directly.\nusing (var s = new MemoryStream(Encoding.UTF8.GetBytes(json)))\n{\n    var value = serializer.Deserialize(s);\n}\n```\n\n`VJson` supports serializing/deserializing of some `System.Collections(.Generics)` classes listed below,\n\n- List\u003cT\u003e\n- Dictionary\u003cstring, T\u003e\n- Array\n\nand user defined classes. For user defined classes, converting only all public fields are supported.\n\ne.g.\n\n(It is strongly recommended to always add VJson attributes such as [JsonField] to fields that you want to treat as Json. This will avoid problems with IL2CPP, especially when using Unity.)\n\n```csharp\nclass SomeObject\n{\n    private float _p = 3.14f;    // Fields which are non-public will not be exported by default.\n    [JsonField] long _p2 = 4;    // Fields which are non-public BUT having [JsonField] (+etc) attributes will BE exported!\n    public int X;                // Fields which are public will be exported by default, but we strongly recommended to add [JsonField] attributes like below.\n    [JsonField] public string Y;\n}\n\nvar obj = new SomeObject {\n    X = 10,\n    Y = \"abab\",\n},\n\nvar serializer = new VJson.JsonSerializer(typeof(SomeObject));\nvar json = serializer.Serialize(obj);\n// \u003e {\"_p2\": 4,\"X\":10,\"Y\":\"abab\"}\n\nvar v = serializer.Deserialize(\"{\\\"X\\\":10,\\\"Y\\\":\\\"abab\\\"}\");\n// \u003e v becomes same as obj.\n```\n\n#### Attributes\n\n...\n\n### JSON Schema and validation\n\n`VJson` supports JSON Schema draft7.\n\n(TODO: Write examples)\n\n#### Attributes\n\n(TODO: Write examples)\n\nOther use cases are available at [here](https://github.com/yutopp/VJson/tree/master/Assets/VJson/Editor/Tests).\n\n## Tasks\n\n- [ ] Performance tuning\n\n## License\n\n[Boost Software License - Version 1.0](./LICENSE_1_0.txt)\n\n## References\n\n- [JSON](https://www.json.org/)\n- [JSON Schema Specification](https://json-schema.org/specification.html)\n\n## Author\n\n- [@yutopp](https://github.com/yutopp)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyutopp%2Fvjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyutopp%2Fvjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyutopp%2Fvjson/lists"}