Aliaksandr Valialkin
Aliaksandr Valialkin
It looks like you posted the issue in incorrect project - this `fastjson` is Go package, while you need [fastjson for Java](https://github.com/alibaba/fastjson) :)
`Parser` can be used repeatedly. Moreover - this is the most optimal usage for `Parser`. But all the objects returned from the `Parse` call become invalid after the next `Parse`...
There is no such API. Use [Object.Visit](https://godoc.org/github.com/valyala/fastjson#Object.Visit) for iterating over all the items in the object or [Object.Get](https://godoc.org/github.com/valyala/fastjson#Object.Get) for obtaining value by key.
`settings.ID` must contain valid JSON if it is passed to `fastjson.MustParse`. An empty string isn't valid JSON. It must be wrapped into double quotes to become valid JSON.
See https://godoc.org/github.com/valyala/fastjson#Arena.NewNumberInt .
The following code shows basic usage for [Arena](https://godoc.org/github.com/valyala/fastjson#Arena): ```go var a fastjson.Arena val.Set("ID", a.NewNumberInt(settings.ID)) ``` This usage isn't optimal from performance point of view, since the `Arena` isn't re-used. This...
> can you also do that? Yes. It is better to allocate the arena only once before the loop: ```go var a fastjson.Arena for _, val := range mapping.data {...
> do you suggest to define var pp fastjson.ParserPool and var ap fastjson.ArenaPool global? yes > how many elements does it preallocate for fastjson.ArenaPool and fastjson.ArenaPool? dont you need to...
> question: can i still iterate over sendData *fastjson.Value in sendData and call req.SetBody(val.String()) ? This is unsafe, since the parser that owns the returned value has been put back...
I'm sorry, but I don't follow what do you mean. Could you provide example code?