A Flutter package designed to repair malformed JSON strings, enabling robust parsing of imperfect or corrupted JSON data. Inspired by Python's json_repair, it automatically fixes common issues like missing commas, unquoted keys, or incorrect nesting. Ideal for handling real-world JSON inputs from unreliable sources such as APIs, user input, or legacy systems. The package supports all major platforms including Android, iOS, Web, macOS, Windows, and Linux, ensuring consistent behavior across environments.
Use cases
- Parsing unreliable API responses
- Handling user-generated JSON input
- Fixing legacy or corrupted JSON data
- Improving resilience in data ingestion pipelines
- Recovering from malformed JSON during app startup
Key features
- Automatic JSON syntax correction
- Supports all Flutter platforms
- Minimal setup with pub add
- Handles common JSON errors like missing commas
- Preserves original data structure when possible
Suitable for
- Developers working with unstable JSON sources
- Apps requiring high data resilience
- Prototyping or debugging JSON issues
- Teams integrating third-party APIs with inconsistent output
Considerations
- May alter original data slightly during repair
- Not a substitute for proper JSON validation
- Best used when exact JSON format cannot be guaranteed
- Performance impact on very large JSON strings
- Should be combined with validation for critical data