jsonut 0.4.0 copy "jsonut: ^0.4.0" to clipboard
jsonut: ^0.4.0 copied to clipboard

A minimal utility kit for working with JSON in a typesafe manner.

JSON Utility Kit #

A minimal utility kit for working with JSON in a type-safe manner.

GitHub Actions Workflow Status

By default, Dart offers very little in the way of JSON parsing and serialization. While upcoming features like macros1 are promising, they are not yet available (as of 2024-03-1). This package uses a (at the time of writing) new language feature, extension types to provide lightweight, type-safe JSON parsing:

import 'package:jsonut/jsonut.dart';

void main() {
  final string = '{"name": "John Doe", "age": 42}';
  final person = JsonObject.parse(string);
  print(person['name'].string()); // John Doe
  print(person['age'].number()); // 42
}

Features #

  • 🦺 Typesafe: JSON parsing and serialization is type-safe and easy to use.
  • 💨 Lightweight: No dependencies, code generation, or reflection.
  • 💪🏽 Flexible: Parse lazily or validate eagerly, as needed.
  • 🚫 No Bullshit: Use as little or as much as you need.

Getting Started #

Simply add the package to your pubspec.yaml:

dependencies:
  jsonut: ^0.4.0

Or use the command line:

dart pub add jsonut
flutter packages add jsonut

Or, even just copy paste the code (a single .dart file) into your project:

curl -o lib/jsonut.dart https://raw.githubusercontent.com/matanlurey/jsonut/main/lib/jsonut.dart
7
likes
140
pub points
54%
popularity

Publisher

verified publisherlurey.dev

A minimal utility kit for working with JSON in a typesafe manner.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on jsonut