ArrayEach + Set lost symbols
Example: you have array of maps, and you need add extra fields to each element of array. This may cause an issue, if maps are big enough. After extending each map result array ([]byte) may reach out of range and you will lost some number of symbols in result.
Code example: https://play.golang.org/p/3QcQtupAfIr
p.s. Update data by slice(referencing) is not obvious.
@sergolius did you ever find a solution to this?
@dcelasun I didn't dig into it much.
I copying original value to v inside of .ArrayEach to break reference and operate with copy:
_, err := jsonparser.ArrayEach([]byte(data),
func(value []byte, dataType jsonparser.ValueType, offset int, err error) {
v := make([]byte, len(value))
copy(v, value)
...
v, _ = jsonparser.Set(v, []byte(`"new_value"`), "key")
Yeah, I've ended up doing the same. Thanks anyway.