{"id":40819373,"url":"https://github.com/sindbach/json-to-bson-go","last_synced_at":"2026-01-21T21:45:17.810Z","repository":{"id":43208079,"uuid":"341028591","full_name":"sindbach/json-to-bson-go","owner":"sindbach","description":"A module to aid developers to generate Go BSON class maps","archived":false,"fork":false,"pushed_at":"2021-03-15T00:52:22.000Z","size":61,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-06-21T15:21:00.881Z","etag":null,"topics":["bson","converter","extended-json","golang","json","mongodb"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindbach.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}},"created_at":"2021-02-21T23:37:42.000Z","updated_at":"2022-11-28T13:06:23.000Z","dependencies_parsed_at":"2022-09-13T17:00:48.288Z","dependency_job_id":null,"html_url":"https://github.com/sindbach/json-to-bson-go","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/sindbach/json-to-bson-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindbach%2Fjson-to-bson-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindbach%2Fjson-to-bson-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindbach%2Fjson-to-bson-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindbach%2Fjson-to-bson-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindbach","download_url":"https://codeload.github.com/sindbach/json-to-bson-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindbach%2Fjson-to-bson-go/sbom","scorecard":{"id":826050,"data":{"date":"2025-08-11","repo":{"name":"github.com/sindbach/json-to-bson-go","commit":"3ccfcdb6957792afdda0289cfc54ba47b06095cc"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.9,"checks":[{"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":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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: Apache License 2.0: 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 'main'"],"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 1 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":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2021-0112 / GHSA-f6mq-5m25-4r72"],"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-23T16:39:55.245Z","repository_id":43208079,"created_at":"2025-08-23T16:39:55.245Z","updated_at":"2025-08-23T16:39:55.245Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28644149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T21:29:11.980Z","status":"ssl_error","status_checked_at":"2026-01-21T21:24:31.872Z","response_time":86,"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":["bson","converter","extended-json","golang","json","mongodb"],"created_at":"2026-01-21T21:45:17.411Z","updated_at":"2026-01-21T21:45:17.800Z","avatar_url":"https://github.com/sindbach.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n\n# JSON to BSON for Golang\n\nA module to aid developers to generate Go BSON class maps. The auto-generated code output utilises [go.mongodb.org/mongo-driver/bson](https://pkg.go.dev/go.mongodb.org/mongo-driver/bson), and is ideal to be used to read/write into [MongoDB](https://www.mongodb.com/).\n\nThis module is able to process both formats: \n\n* [Standard JSON](https://www.json.org/json-en.html)\n* [MongoDB Extended JSON v2](https://docs.mongodb.com/manual/reference/mongodb-extended-json/)\n\nYou can see the module in action on https://json-to-bson-map.netlify.app/ \n\n## Install \n\n```\ngo get -u github.com/sindbach/json-to-bson-go\n```\n\n## Usage Example \n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/sindbach/json-to-bson-go/convert\"\n    \"github.com/sindbach/json-to-bson-go/options\"\n)\n\nfunc main() {\n    doc := `{\"foo\": \"buildfest\", \"bar\": {\"$numberDecimal\":\"2021\"} }`\n    opt := options.NewOptions()\n    result, _ := convert.Convert([]byte(doc), opt)\n    fmt.Println(result)\n}\n```\n\nThe output of the above code: \n\n```go\npackage main\n\nimport \"go.mongodb.org/mongo-driver/bson/primitive\"\n\ntype Example struct {\n    Foo string               `bson:\"foo\"`\n    Bar primitive.Decimal128 `bson:\"bar\"`\n}\n```\n\n## Behaviour and Limitations\n\nAs of current latest version, these are the limitations: \n\n\n| Case           | Ex. input        | Ex. output        | Description        \n|----------------|------------------|-------------------| ---------------|\n| Array of array consistent| `[[1, 2], [3, 4]]` | `[][]int32`\n| Array of array inconsistent | `[[1, 2], \"foo\"]` | `[]interface{}`\n| Array of array nest level | `[[[1, 2]]]`      | `[][]interface{}`   | \n| Array of document | `[{\"a\": 1}]` | `[]A{}`\n\n## Options \n\nAvailable options\n\n| Name             | Syntax      | Description   \n| ----------------------- | ---------------- | ---------------- |\n| Struct Name             | `opt.SetStructName(string)` | Specifies the name of the generated struct. The default value is \"AutoGenerated\".\n| Minimize Integer Size   | `opt.SetMinimizeIntegerSize(bool)` | Specifies how JSON numbers should be represented in Go types. If false, numbers in JSON input will always be represented as float64 in structs.If true, JSON numbers will be represented using either int32, int64, float32, or float64. For example, the JSON field \"x: 100\" would be converted to the struct field \"X int32\" while \"x: 2^32 + 10\" would be converted to \"X int64\" because (2^32 + 10) overflows int32. The default value is `false`\n| Trucate Integers        | `opt.SetTruncateIntegers(bool)` | Specifies whether or not integer fields in generated structs should have the \"truncate\" BSON struct tag. This tag enables non-integer data to be decoded into the integer field at the risk of loss of precision. For example, if this option is true and SetMinimizeIntegerSize is true, the JSON field \"x: 1.0\" would be converted to struct field \"X int32 `bson:\"x,truncate\"`\", which would allow data like \"x: 5.4\" to be decoded into the struct. This option is a no-op if SetMinimizeIntegerSize(false) is also called because in that case, all numeric JSON fields are converted to float64 and the \"truncate\" tag is not meaningful for that type. The default value is `false`.\n\n\n## Need help?\nIf you get stuck, or have a question, please feel free to open an issue.\n\n## License\n\nThis repo is covered under [Apache License v2](LICENSE). \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindbach%2Fjson-to-bson-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindbach%2Fjson-to-bson-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindbach%2Fjson-to-bson-go/lists"}