{"id":16699430,"url":"https://github.com/ousttrue/osaru","last_synced_at":"2026-04-16T09:01:54.175Z","repository":{"id":136460603,"uuid":"83228287","full_name":"ousttrue/Osaru","owner":"ousttrue","description":"JSON parser for .Net3.5(Unity)","archived":false,"fork":false,"pushed_at":"2017-07-05T16:00:03.000Z","size":698,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-01T04:23:10.497Z","etag":null,"topics":["json-parser","messagepack","unity"],"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/ousttrue.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-26T17:45:12.000Z","updated_at":"2018-05-02T12:39:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"c7124e00-8139-470e-9706-13e732876703","html_url":"https://github.com/ousttrue/Osaru","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ousttrue/Osaru","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ousttrue%2FOsaru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ousttrue%2FOsaru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ousttrue%2FOsaru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ousttrue%2FOsaru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ousttrue","download_url":"https://codeload.github.com/ousttrue/Osaru/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ousttrue%2FOsaru/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31878830,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T07:36:03.521Z","status":"ssl_error","status_checked_at":"2026-04-16T07:35:53.576Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["json-parser","messagepack","unity"],"created_at":"2024-10-12T18:06:57.907Z","updated_at":"2026-04-16T09:01:54.158Z","avatar_url":"https://github.com/ousttrue.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Osaru\nObject Serialization And RPC Utilities\n\n.Net3.5(Unity) Serialization library.\n\n```\n                     +----------+\n                     |RPC method|\n                     +----------+\n                       ^     |\n+----------------+     |     v    +--------------+\n|IDeserializer\u003cT\u003e| -\u003e  T     U -\u003e |ISerializer\u003cU\u003e|\n+----------------+                +--------------+\n  ^                                 |\n  |                                 v\n+-------+    convert              +----------+\n|IParser| ----------------------\u003e |IFormatter|\n+-------+                         +----------+\n  ^                               |IStore    | --\u003e Stream\n  |           +-----------+       +--------- +\n  +-----------|JSON       |\u003c--------+\n              |MessagePack|         Byte[]\n              +-----------+\n            serialized byte[]\n```\n\n# Features\n* separate deserializer and parser\n* separate serializer and formatter\n* inplace serialization\n* inplace deserialization(but struct field setter use boxing)\n* UWP compatible\n\n# Formats\n\n## JSON\n* http://www.json.org/index.html\n* http://www.jsonrpc.org/specification\n\n## MessagePack\n* https://github.com/msgpack/msgpack/blob/master/spec.md\n* https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md\n\n# Usage\n\n## parse json\n\n```cs\nvar src = \"{\\\"key\\\":{ \\\"nestedKey\\\": \\\"nestedValue\\\" } }\";\nvar json = JsonParser.Parse(src);\n\nAssert.AreEqual(\"nestedValue\", json[\"key\"][\"nestedKey\"].GetString());\n```\n\n## json array\n\n```cs\nvar json = JsonParser.Parse(\"[1, 2, 3]\");\nfor(var item in json.ListItems)\n{\n    Console.WriteLine(item.GetInt32());\n}\n```\n\n## json object\n\n```cs\nusing Osaru;\n\nvar json = \"{\\\"key\\\": \\\"value\\\"}\".ParseAsJson();\nfor(var item in json.ObjectItems)\n{\n    Console.WriteLine(item.Key); // JSON allow only string key\n    Console.WriteLine(item.Value.GetString());\n}\n```\n\n## json formatter\n\n```cs\nusing Osaru.Json;\n\nvar f=new JsonFormatter();\nf.Value(\"abc\");\nConsole.WriteLine(f.ToString()); // \"abc\"\n\nf.Clear();\nf.BeginList();\nf.Value(true);\nf.Null();\nf.Value(1);\nf.EndList();\nConsole.WriteLine(f.ToString()); // [true,null,1]\n\nf.Clear();\nf.BeginMap();\nf.Key(\"key1\"); f.Value(true);\nf.Key(\"key2\"); f.Null();\nf.Key(\"key3\"); f.Value(1);\nf.EndMap();\nConsole.WriteLine(f.ToString()); // {\"key1\":true,\"key2\":null,\"key3\":1}\n\n// get bytes\nArraySegment\u003cByte\u003e=f.GetStore().Bytes;\n```\n\n## customize json formatter\n\n```cs\nusing Osaru.Json;\n\nvar s=new FileStream(\"out.json\", FileMode.Create);\nvar f=new JsonFormatter(new StreamStore(s));\n```\n\n## serialize \u0026 deserialize\n\n```cs\nusing Osaru;\nusing Osaru.Serialization;\n\nclass Point\n{\n    public int X;\n    public int Y;\n    public Point(int x, int y)\n    {\n        X=x;\n        Y=y;\n    }\n}\n\nvar r=new TypeRegistory();\n\n// serialize\nvar bytes=r.SerializeToJsonBytes(new Point(1, 2));\n\n// parse as json\nvar json=bytes.ParseAsJson();\nConsole.WriteLine(json[\"X\"]); // 1\nConsole.WriteLine(json[\"Y\"]); // 2\n\n// deserialize\nvar p=default(Point);\nr.Deserialize(json, ref p);\nConsole.WriteLine(p.X); // 1\nConsole.WriteLine(p.Y); // 2\n```\n\n## custom serialization\n\n## RPC\n\n```cs\nusing Osaru;\nusing Osaru.Serialization;\nusing Osaru.RPC;\n\n\n// setup\nvar typeRegistory = new TypeRegistory();\nvar method = typeRegistory.RPCFunc((int a, int b) =\u003e a + b);\nvar dispatcher = new RPCDispatcher();\ndispatcher.AddMethod(\"Add\", method);\n\n// request\nvar request = \"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"method\\\":\\\"Add\\\",\\\"params\\\":[1,2],\\\"id\\\":1}\";\nvar responseBytes = dispatcher.Dispatch(request.ParseAsJson());\nvar response=Encoding.UTF8.GetString(responseBytes.Array, responseBytes.Offset, responseBytes.Count);\nAssert.AreEqual(\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"result\\\":3,\\\"id\\\":1}\", response);\n```\n\n# ToDO\n* [x] integrate [MsgPack library](https://github.com/ousttrue/NMessagePack)\n* [x] reorganize messagepack library\n* [x] fix UWP UnitTest\n* [x] RPCFormatter\n* [x] user class serialization\n* [x] json and messagepack converter\n* [x] json-rpc-2.0\n* [x] messagepack-rpc\n* [ ] code generator for RPC client\n* [x] json base64 string for binary support\n* [x] json byte[] backend not string\n* [x] StreamStore\n* [x] BytesStore\n* [x] fix IParser.Dump\n* [x] rpc proxy\n* [x] endian conversion use union\n* [x] add Endian interface to IStore \n* [ ] commonalize tests for json and messagepack\n* [x] organize extensions\n* [ ] rpc error handling\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fousttrue%2Fosaru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fousttrue%2Fosaru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fousttrue%2Fosaru/lists"}