valyala / fastjson

Fast JSON parser and validator for Go. No custom structs, no code generation, no reflection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to decode JSON from []byte?

rushkii opened this issue · 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.

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

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?

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