Earlier quoted context omitted.
Those numbers look similar to goccy. I used to use it in the past, even Kubernetes uses it as direct dependency, but the amount of issues have been stockpiling for quite some time so I no longer trust it. So it seems both are operating at the edge of Go's capabilities. Personally, I think JSON should be in Go's core and highly optimised simd c code and not in the Go's std library as standard Go code. As JSON is such…
What does "highly optimized" have to do with whether it's in the standard library? Highly-optimized cryptography is in the standard library.
A new experimental Go API for JSON
11–20 of 110 posts
Re: A new experimental Go API for JSON
#12It is good to see some partial solutions to this issue. It plagues most languages and introduces a nice little ambiguity that is just trouble waiting to happen.
Ironically, JavaScript with its hilarious `null` and `undefined` does not have this problem.
Most JSON parsers and emitters in most languages should use a special value for "JSON null".
Re: A new experimental Go API for JSON
#13Earlier quoted context omitted.
What is your preferred behavior for a nil map/slice? Feels weird that it doesn't map to null.
When you are unmarshaling json, empty map/slice is something completely different than a null or no value present, as you are losing intent of the sender, in case of JSON REST. For example, if my intent is to keep the present value, I will send {"foo": 1} or {"foo": 1, "bar": null} as null and no value has the same meaning. On the other hand, I might want to change the existing value to empty one and send {"foo": 1,…
Re: A new experimental Go API for JSON
#14null != nil !!! It is good to see some partial solutions to this issue. It plagues most languages and introduces a nice little ambiguity that is just trouble waiting to happen. Ironically, JavaScript with its hilarious `null` and `undefined` does not have this problem. Most JSON parsers and emitters in most languages should use a special value for "JSON null".
Re: A new experimental Go API for JSON
#15No, it's an exception. It was badly designed from the start - it's not just that people's json needs (which hardly changed) outgrew it.
Re: A new experimental Go API for JSON
#16Benchmark Analysis: Sonic vs Standard JSON vs JSON v2 in Go https://github.com/centralci/go-benchmarks/tree/b647c45272c7...
Those numbers look similar to goccy. I used to use it in the past, even Kubernetes uses it as direct dependency, but the amount of issues have been stockpiling for quite some time so I no longer trust it. So it seems both are operating at the edge of Go's capabilities. Personally, I think JSON should be in Go's core and highly optimised simd c code and not in the Go's std library as standard Go code. As JSON is such…
I think when it's introduced it might be worth discussing that again. Otherwise providing assembly for JSON of all packages seems like a huge maintenance burden for very little benefit for end users (since faster alternatives are readily available)
Re: A new experimental Go API for JSON
#17> Over time, packages evolve with the needs of their users, and encoding/json is no exception No, it's an exception. It was badly designed from the start - it's not just that people's json needs (which hardly changed) outgrew it.
Over time, it became evident that the JSON package didn't meet the needs of its users, and the package has evolved as a result. The size of the evolution doesn't matter.
Re: A new experimental Go API for JSON
#18Earlier quoted context omitted.
Those numbers look similar to goccy. I used to use it in the past, even Kubernetes uses it as direct dependency, but the amount of issues have been stockpiling for quite some time so I no longer trust it. So it seems both are operating at the edge of Go's capabilities. Personally, I think JSON should be in Go's core and highly optimised simd c code and not in the Go's std library as standard Go code. As JSON is such…
What does "highly optimized" have to do with whether it's in the standard library? Highly-optimized cryptography is in the standard library.
Edit: See: https://go.dev/wiki/AssemblyPolicy
Re: A new experimental Go API for JSON
#19Re: A new experimental Go API for JSON
#20null != nil !!! It is good to see some partial solutions to this issue. It plagues most languages and introduces a nice little ambiguity that is just trouble waiting to happen. Ironically, JavaScript with its hilarious `null` and `undefined` does not have this problem. Most JSON parsers and emitters in most languages should use a special value for "JSON null".
obj['key']=undefined
was the same as
delete obj['key']