mirror of
https://github.com/gofiber/fiber.git
synced 2025-04-27 13:14:31 +00:00
* Add support for consistent documentation using markdownlint * Only run workflow during changes to markdown files * Fix more inconsistencies * Fixes to markdown under .github/ * More fixes * Apply suggestions from code review Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Fix typo in limiter docs * Add missing space before code-block * Add check for dead-links * Add write-good * Remove legacy README files * Fix glob for skipping .md files * Use paths-ignore instead --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
38 lines
1.2 KiB
Markdown
38 lines
1.2 KiB
Markdown
---
|
|
id: faster-fiber
|
|
title: ⚡ Make Fiber Faster
|
|
sidebar_position: 7
|
|
---
|
|
|
|
## Custom JSON Encoder/Decoder
|
|
|
|
Since Fiber v2.32.0, we have adopted `encoding/json` as the default JSON library for its stability and reliability. However, the standard library can be slower than some third-party alternatives. If you find the performance of `encoding/json` unsatisfactory, we suggest considering these libraries:
|
|
|
|
- [goccy/go-json](https://github.com/goccy/go-json)
|
|
- [bytedance/sonic](https://github.com/bytedance/sonic)
|
|
- [segmentio/encoding](https://github.com/segmentio/encoding)
|
|
- [minio/simdjson-go](https://github.com/minio/simdjson-go)
|
|
|
|
```go title="Example"
|
|
package main
|
|
|
|
import "github.com/gofiber/fiber/v3"
|
|
import "github.com/goccy/go-json"
|
|
|
|
func main() {
|
|
app := fiber.New(fiber.Config{
|
|
JSONEncoder: json.Marshal,
|
|
JSONDecoder: json.Unmarshal,
|
|
})
|
|
|
|
# ...
|
|
}
|
|
```
|
|
|
|
### References
|
|
|
|
- [Set custom JSON encoder for client](../client/rest.md#setjsonmarshal)
|
|
- [Set custom JSON decoder for client](../client/rest.md#setjsonunmarshal)
|
|
- [Set custom JSON encoder for application](../api/fiber.md#jsonencoder)
|
|
- [Set custom JSON decoder for application](../api/fiber.md#jsondecoder)
|