{"repo":"sindbach/json-to-bson-go","free":true,"listed":false,"github":"https://github.com/sindbach/json-to-bson-go","clone":"git clone https://github.com/sindbach/json-to-bson-go.git","description":"A module to aid developers to generate Go BSON class maps","language":"Go","stars":12,"topics":["mongodb","bson","golang","json","converter","extended-json"],"license":"Apache-2.0","category":"data-pipelines","readme_excerpt":"JSON to BSON for Golang A module to aid developers to generate Go BSON class maps. The auto-generated code output utilises go.mongodb.org/mongo-driver/bson, and is ideal to be used to read/write into MongoDB. This module is able to process both formats: Standard JSON MongoDB Extended JSON v2 You can see the module in action on https://json-to-bson-map.netlify.app/ Install Usage Example The output of the above code: Behaviour and Limitations As of current latest version, these are the limitations: Case Ex. input Ex. output Description ---------------- ------------------ ------------------- --------------- Array of array consistent [[1, 2], [3, 4]] [][]int32 Array of array inconsistent [[1, 2], \"foo\"] []interface{} Array of array nest level [[[1, 2]]] [][]interface{} Array of document [{\"a\": 1}] []A{} Options Available options Name Syntax Description ----------------------- ---------------- ---------------- Struct Name opt.SetStructName(string) Specifies the name of the generated struct. The default value is \"AutoGenerated\". 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 int3","default_branch":null,"files":null,"tree":[],"storefront":"/r/sindbach","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/sindbach/json-to-bson-go/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}