Note: This repository includes a Dart port adapted from the original jsonrepair project: https://github.com/josdejong/jsonrepair. It is a port, not an original implementation authored here.

jsonrepair_dart

Repair invalid JSON documents.

This package is a Dart port of the regular (non-streaming) API from the JavaScript jsonrepair library.

Install

dart pub add jsonrepair_dart

Usage

import 'package:jsonrepair_dart/jsonrepair_dart.dart';

void main() {
  final repaired = jsonrepair("{name: 'John'}");
  print(repaired); // {"name": "John"}
}

API

  • jsonrepair(String input) -> String
  • throws JsonRepairError when repair is not possible