sonic VS fastjson

Compare sonic vs fastjson and see what are their differences.

sonic

A blazingly fast JSON serializing & deserializing library (by bytedance)

fastjson

Fast JSON parser and validator for Go. No custom structs, no code generation, no reflection (by valyala)
Our great sponsors
  • InfluxDB - Collect and Analyze Billions of Data Points in Real Time
  • Onboard AI - Learn any GitHub repo in 59 seconds
  • SaaSHub - Software Alternatives and Reviews
sonic fastjson
21 18
5,769 2,038
3.3% -
6.3 0.0
12 days ago 5 days ago
Go Go
Apache License 2.0 MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

sonic

Posts with mentions or reviews of sonic. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-11-06.

fastjson

Posts with mentions or reviews of fastjson. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-06-29.
  • What's the best way to unmarshall this nested JSON?
    3 projects | /r/golang | 29 Jun 2023
    I’ve used fastjson when unmarshalling to Structs is inconvenient. https://github.com/valyala/fastjson
  • Object-oriented JSON in Go
    2 projects | /r/golang | 12 Apr 2023
    Interesting approach, even though reflection support is supposed to be landing soon, this would be really really useful when using TinyGo. (Fro example, writing web backend serverless functions with Fermyon’s Spin framework for WASM that needs to return JSON). Do you have any benchmarks on how it performs vs stdlib’s encoding/json and/or something like fastjson?
  • Best approach for a monolithic web app?
    2 projects | /r/golang | 9 Apr 2023
  • High-performance JSON parsing in Go
    4 projects | /r/golang | 8 Mar 2023
    FastJason (https://github.com/valyala/fastjson) does not use code generation or structs and is great for parsing very dynamic schemas.
    4 projects | /r/golang | 8 Mar 2023
    It relies heavily on bytes.IndexOf for which Go provides SIMD optimizations transparently. However, it has some correctness issues when parsing malformed json that might need to be addressed. Generally it is recommended to be used with trusted json documents for internal services and may require further testing before being used to parse arbitrary json documents.
  • 3 Ways I Keep My Rest APIs endpoints down to 4-6 lines and eliminate boilerplate. What are yours?
    3 projects | /r/golang | 4 Mar 2023
    Try fastjson library. It allows you to grab deeply nested json objects without marshalling the entire json.
  • Any way to convert unknown/dynamic json to generic object structure
    3 projects | /r/golang | 2 Mar 2023
  • Golang, GraphQL y Postgress
    2 projects | /r/devsarg | 26 Jan 2023
    Como herramientas te recomiendo: FastJson https://github.com/valyala/fastjson : Si necesitas leer jsons Testify https://github.com/stretchr/testify : Para mockear y testear
  • Ad hoc JSON parsing
    4 projects | /r/golang | 16 Jan 2023
    In Go if I need to extract just a few fields from a large JSON document it's hard to beat https://github.com/valyala/fastjson
  • TinyGo Reflection?
    4 projects | /r/golang | 6 Dec 2022
    Another option is to use what I like to call "Lazy" decoders, like https://github.com/valyala/fastjson which will work with TinyGo, but doesn't have the same type of API as the standard lib (or alternatives) in terms of Marshaling and Unmarshalling. Instead you "Parse" a JSON object, and use Getters to access the types you want.

What are some alternatives?

When comparing sonic and fastjson you can also consider the following projects:

easyjson - Fast JSON serializer for golang.

jsoniter - Using encoding/json to load parts of a large json document

jsonparser - One of the fastest alternative JSON parser for Go that does not require schema

encoding - Go package containing implementations of efficient encoding, decoding, and validation APIs.

simdjson - Parsing gigabytes of JSON per second : used by Facebook/Meta Velox, the Node.js runtime, WatermelonDB, Apache Doris, Milvus, StarRocks

mapslice-json - Go MapSlice for ordered marshal/ unmarshal of maps in JSON

jsonic - All you need with JSON

go-parameters - :blue_book: Easily parse incoming parameters and values from an HTTP request

ojg - Optimized JSON for Go

omg.jsonparser - The simple JSON parser with validation by condition

epoch - Contains primitives for marshaling/unmarshaling Unix timestamp/epoch to/from built-in time.Time type in JSON

jzon - A golang json library inspired by jsoniter