Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cornelk/orderedmap
A Golang Map that keeps track of the insert order of items.
https://github.com/cornelk/orderedmap
go golang hashmap map orderedmap
Last synced: 20 days ago
JSON representation
A Golang Map that keeps track of the insert order of items.
- Host: GitHub
- URL: https://github.com/cornelk/orderedmap
- Owner: cornelk
- License: apache-2.0
- Created: 2022-08-29T00:29:04.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-29T02:00:46.000Z (over 2 years ago)
- Last Synced: 2024-10-16T12:26:27.621Z (2 months ago)
- Topics: go, golang, hashmap, map, orderedmap
- Language: Go
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# orderedmap
[![Build status](https://github.com/cornelk/orderedmap/actions/workflows/go.yaml/badge.svg?branch=main)](https://github.com/cornelk/orderedmap/actions)
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/cornelk/orderedmap)
[![Go Report Card](https://goreportcard.com/badge/github.com/cornelk/orderedmap)](https://goreportcard.com/report/github.com/cornelk/orderedmap)
[![codecov](https://codecov.io/gh/cornelk/orderedmap/branch/main/graph/badge.svg?token=NS5UY28V3A)](https://codecov.io/gh/cornelk/orderedmap)## Overview
A Golang Map that keeps track of the insert order of items.
The current version can be used as a replacement for `map[string]interface{}` and allows JSON unmarshalling into it.
No manual adding of items is currently possible.## Usage
Unmarshall and marshall JSON:
```
var m Map
input := `{"423":"abc","231":"dbh","152":"xyz"}`m.UnmarshalJSON([]byte(input))
output, _ := m.MarshalJSON()
# unlike the standard Golang map, the output will be exact the same and not in random key order
```