{"id":36805011,"url":"https://github.com/nqd/flat","last_synced_at":"2026-01-12T13:38:33.957Z","repository":{"id":44335946,"uuid":"165084512","full_name":"nqd/flat","owner":"nqd","description":"Flatten/unflatten nested map or JSON object in Golang ","archived":false,"fork":false,"pushed_at":"2023-04-24T18:02:50.000Z","size":52,"stargazers_count":69,"open_issues_count":3,"forks_count":18,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-13T18:42:58.437Z","etag":null,"topics":["flat","flatten","golang","json","struct"],"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/nqd.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":"2019-01-10T15:32:46.000Z","updated_at":"2025-06-06T12:40:55.000Z","dependencies_parsed_at":"2024-06-18T15:22:57.713Z","dependency_job_id":null,"html_url":"https://github.com/nqd/flat","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/nqd/flat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nqd%2Fflat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nqd%2Fflat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nqd%2Fflat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nqd%2Fflat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nqd","download_url":"https://codeload.github.com/nqd/flat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nqd%2Fflat/sbom","scorecard":{"id":696578,"data":{"date":"2025-08-11","repo":{"name":"github.com/nqd/flat","commit":"1b37ff8aebb771f6f6c1c235f7446be33bde1652"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Code-Review","score":2,"reason":"Found 4/16 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/rebase.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/nqd/flat/rebase.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/rebase.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/nqd/flat/rebase.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/nqd/flat/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/nqd/flat/test.yml/master?enable=pin","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/rebase.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 26 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T03:53:18.226Z","repository_id":44335946,"created_at":"2025-08-22T03:53:18.226Z","updated_at":"2025-08-22T03:53:18.226Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28339300,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["flat","flatten","golang","json","struct"],"created_at":"2026-01-12T13:38:33.844Z","updated_at":"2026-01-12T13:38:33.933Z","avatar_url":"https://github.com/nqd.png","language":"Go","readme":"# flat [![Build Status](https://secure.travis-ci.org/nqd/flat.png?branch=master)](http://travis-ci.org/nqd/flat)\n\nTake a golang map and flatten it or unfatten a map with delimited key.\n\nThis work inspired by the [nodejs flat package](https://github.com/hughsk/flat/)\n\n## Method\n\n### Flatten\n\nFlatten given map, returns a map one level deep.\n\n```{go}\nin := map[string]interface{}{\n    \"a\": \"b\",\n    \"c\": map[string]interface{}{\n        \"d\": \"e\",\n        \"f\": \"g\",\n    },\n    \"z\": [2, 1.4567],\n}\n\nout, err := flat.Flatten(in, nil)\n// out = map[string]interface{}{\n//     \"a\": \"b\",\n//     \"c.d\": \"e\",\n//     \"c.f\": \"g\",\n//     \"z.0\": 2,\n//     \"z.1\": 1.4567,\n// }\n```\n\n### Unflatten\n\nSince there is flatten, flat should have unfatten.\n\n```{go}\nin := map[string]interface{}{\n    \"foo.bar\": map[string]interface{}{\"t\": 123},\n    \"foo\":     map[string]interface{}{\"k\": 456},\n}\n\nout, err := flat.Unflatten(in, nil)\n// out = map[string]interface{}{\n//     \"foo\": map[string]interface{}{\n//         \"bar\": map[string]interface{}{\n//             \"t\": 123,\n//         },\n//         \"k\": 456,\n//     },\n// }\n```\n\n## Options\n\n### Delimiter\n\nUse a custom delimiter for flattening/unflattening your objects. Default value is `.`.\n\n```{go}\nin := map[string]interface{}{\n   \"hello\": map[string]interface{}{\n       \"world\": map[string]interface{}{\n           \"again\": \"good morning\",\n        }\n    },\n}\n\nout, err := flat.Flatten(in, \u0026flat.Options{\n    Delimiter: \":\",\n})\n// out = map[string]interface{}{\n//     \"hello:world:again\": \"good morning\",\n// }\n```\n\n### Safe\n\n\u003c!-- When Safe is true, both fatten and unflatten will preserve arrays and their contents. Default Safe value is `false`. --\u003e\nWhen Safe is true, fatten will preserve arrays and their contents. Default Safe value is `false`.\n\n```{go}\nin := map[string]interface{}{\n    \"hello\": map[string]interface{}{\n        \"world\": []interface{}{\n            \"one\",\n            \"two\",\n        }\n   },\n}\n\nout, err := flat.Flatten(in, \u0026flat.Options{\n    Delimiter: \".\",\n    Safe:      true,\n})\n// out = map[string]interface{}{\n//     \"hello.world\": []interface{}{\"one\", \"two\"},\n// }\n```\n\n\u003c!-- Example of Unflatten goes here --\u003e\n\n### MaxDepth\n\nMaxDepth is the maximum number of nested objects to flatten. MaxDepth can be any integer number. MaxDepth = 0 means no limit.\n\nDefault MaxDepth value is `0`.\n\n```{go}\nin := map[string]interface{}{\n    \"hello\": map[string]interface{}{\n        \"world\": []interface{}{\n            \"again\": \"good morning\",\n        }\n   },\n}\n\nout, err := flat.Flatten(in, \u0026flat.Options{\n    Delimiter: \".\",\n    MaxDepth:  2,\n})\n// out = map[string]interface{}{\n//     \"hello.world\": map[string]interface{}{\"again\": \"good morning\"},\n// }\n```\n\n## Todos\n\n- [ ] Safe option for Unflatten\n- [ ] Overwrite","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnqd%2Fflat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnqd%2Fflat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnqd%2Fflat/lists"}