fastjson icon indicating copy to clipboard operation
fastjson copied to clipboard

How to decode JSON from []byte?

Open rushkii opened this issue 4 years ago • 3 comments

Hello, I want to decode JSON response from fasthttp.Response Body() []byte, but I don't know how to do it. I currently using encoding/json decoder.

rushkii avatar Mar 20 '22 08:03 rushkii

before asking questions on anything, you should at the very least read the readme https://github.com/valyala/fastjson#usage instead of Parse.. you can use ParseBytes.. which there are also plenty of posts about in examples etc

G2G2G2G avatar Apr 29 '22 01:04 G2G2G2G

before asking questions on anything, you should at the very least read the readme https://github.com/valyala/fastjson#usage instead of Parse.. you can use ParseBytes.. which there are also plenty of posts about in examples etc

Hmmm oke, but I think it doesn't support parsing to a struct?

rushkii avatar Apr 29 '22 05:04 rushkii

which is why fastjson and other json libraries aren't slow as hell like default marshaller.. just use that if you use a struct. derp

G2G2G2G avatar Apr 29 '22 13:04 G2G2G2G