I am able to retrieve the JSON that I'm interested at path $.FullOTAConfig.Licensing via:
// JSON map interface
jsonInput map[string]interface{}
// Load some JSON
// ...
// ...
// Get JSON at the requested path
subJson, err := jsonpath.Get(jsonPath, jsonInput)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
// How do I update the JSON at path 'jsonPath'?
// ... ???
// jsonInput[?] = new_json_object
but what I would like to do is once the subobject is returned, I want to update the 'jsonInput' var but I don't know how I can use the jsonpath to then update the JSON in the map based on the path.
I'm new to golang, so my question probably more stems from a lack of knowledge, but I'm getting there.
I have a small JSON sample that looks like the following:
I am able to retrieve the JSON that I'm interested at path
$.FullOTAConfig.Licensing
via:but what I would like to do is once the subobject is returned, I want to update the 'jsonInput' var but I don't know how I can use the jsonpath to then update the JSON in the map based on the path.