{"id":30618187,"url":"https://github.com/hyper-solutions/orderedobject","last_synced_at":"2025-08-30T11:09:41.340Z","repository":{"id":231548238,"uuid":"782031001","full_name":"Hyper-Solutions/orderedobject","owner":"Hyper-Solutions","description":"A map that respects insertion order when serialized to JSON","archived":false,"fork":false,"pushed_at":"2024-04-04T14:17:27.000Z","size":5,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-23T01:32:10.964Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/Hyper-Solutions.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":"2024-04-04T14:01:44.000Z","updated_at":"2024-12-10T16:05:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"a3d7d090-54ae-495e-9d82-5a23b5ce7936","html_url":"https://github.com/Hyper-Solutions/orderedobject","commit_stats":null,"previous_names":["hyper-solutions/orderedobject"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Hyper-Solutions/orderedobject","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hyper-Solutions%2Forderedobject","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hyper-Solutions%2Forderedobject/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hyper-Solutions%2Forderedobject/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hyper-Solutions%2Forderedobject/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Hyper-Solutions","download_url":"https://codeload.github.com/Hyper-Solutions/orderedobject/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Hyper-Solutions%2Forderedobject/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272839800,"owners_count":25001886,"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-30T02:00:09.474Z","response_time":77,"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":[],"created_at":"2025-08-30T11:09:40.299Z","updated_at":"2025-08-30T11:09:41.254Z","avatar_url":"https://github.com/Hyper-Solutions.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# orderedobject\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/Hyper-Solutions/orderedobject.svg)](https://pkg.go.dev/github.com/Hyper-Solutions/orderedobject)\n\n`orderedobject` is a simple Go package that provides an `Object` type for representing JSON objects that respect insertion order. It uses generics to allow for type-safe usage with any value type.\n\n## Installation\n\nTo install the package, use `go get`:\n\n```shell\ngo get github.com/Hyper-Solutions/orderedobject\n```\n\n## Usage\n\nHere's a simple usage example:\n\n```go\npackage main\n\nimport (\n    \"encoding/json\"\n    \"fmt\"\n\n    \"github.com/Hyper-Solutions/orderedobject\"\n)\n\nfunc main() {\n    // Create a new object with a capacity of 3\n    obj := orderedobject.NewObject[any](3)\n\n    // Set key-value pairs\n    obj.Set(\"name\", \"John\")\n    obj.Set(\"age\", 30)\n    obj.Set(\"city\", \"New York\")\n\n    // Marshal the object to JSON\n    encoded, err := json.Marshal(obj)\n    if err != nil {\n        panic(err)\n    }\n\n    fmt.Println(string(encoded))\n    // Output: {\"name\":\"John\",\"age\":30,\"city\":\"New York\"}\n}\n```\n\nThe `Object` type provides the following methods:\n\n- `NewObject[V any](capacity int) *Object[V]`: Creates a new `Object` with the specified capacity.\n- `Set(key string, value V)`: Sets a key-value pair in the object. If the key already exists, its value is replaced.\n- `Has(key string) bool`: Checks if a key is set in the object.\n- `Get(key string) V`: Retrieves the value associated with a key. If the key is not set, the zero value of type `V` is returned.\n- `MarshalJSON() ([]byte, error)`: Marshals the object to JSON, respecting the insertion order of key-value pairs.\n\n## License\n\nThis package is licensed under the [MIT License](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyper-solutions%2Forderedobject","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyper-solutions%2Forderedobject","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyper-solutions%2Forderedobject/lists"}