Closed Dragomir-Ivanov closed 4 years ago
Hi again, Here is one naive implementation of the said feature:
func (j *JSONQ) FromInterface(v interface{}) *JSONQ {
if m, ok := v.(map[string]interface{}); ok {
j.rootJSONContent = m
j.jsonContent = j.rootJSONContent
return j
}
return j.addError(fmt.Errorf("%s is not map[string]interface{}", v))
}
If you are willing to merge this, I will make a proper PR with test cases added. Thanks. I really need this.
This is available from v2.5.0
Thanks a ton!
Hi there, Is there any way to load JSON document from
map[string]interface{}
? Simplest use case is querying MongoDB, which returns result documents in that format(without using schema struct). I am willing to make a PR if little help is supplied. Thanks