Open Robert-M-Muench opened 2 years ago
dest := "[]" r := gjson.Get(source, "[a, b]" dest = sjson.Set(dest, ".-1", r.String())
r is something like ["a_value","b_value"] and gets inserted into dest as [[["a_value","b_value"]]]
How can I insert the already arryfied JSON as-is into dest and avoid that it gets arryfied once again?
Perhaps the SetRaw function is what you are looking for.
SetRaw
r := gjson.Parse(`["a_value","b_value"]`) dest := "[]" dest, _ = sjson.SetRaw(dest, "-1", r.String()) println(dest)
[["a_value","b_value"]]
r is something like ["a_value","b_value"] and gets inserted into dest as [[["a_value","b_value"]]]
How can I insert the already arryfied JSON as-is into dest and avoid that it gets arryfied once again?