FLUTTER ECOSYSTEM

canonical_json

Encoder and decoder for a canonical JSON format, useful when cryptographically hashing or signing JSON objects.

Latest version
1.1.3
30-day downloads
35.2K
Likes
11
Pub points
160

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Overview

A Flutter/Dart package that provides a canonical JSON encoder and decoder, ensuring consistent serialization of JSON objects. This is particularly useful for cryptographic operations like hashing or signing, where identical input must always produce the same output regardless of formatting variations. The package enforces strict ordering of keys and precise formatting to achieve determinism. It supports all major platforms including Android, iOS, Web, macOS, Windows, and Linux, making it ideal for cross-platform applications requiring secure and predictable JSON handling.

Use cases
  • Cryptographic hashing of JSON data
  • Secure signing of JSON payloads
  • Deterministic JSON serialization
  • Cross-platform data consistency
  • API request/response integrity verification
  • JSON-based digital signatures
Key features
  • Strict key ordering
  • No whitespace or formatting variation
  • Deterministic output
  • Supports all major platforms
  • Lightweight and efficient
  • Complies with canonical JSON standards
Suitable for
  • Applications requiring secure JSON processing
  • Systems needing reproducible hash values
  • Blockchain or cryptographic protocols
  • Interoperable APIs with strict serialization rules
  • Developers building secure data exchange systems
Considerations
  • Not suitable for human-readable JSON output
  • May impact performance with very large JSON structures
  • Requires careful handling in debugging due to strict formatting
  • Limited to use cases where determinism is critical
  • Does not support custom serialization logic
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add canonical_json

Categories

Dependencies

Dependency list 2 items

Source repository

Related projects