Search packages, repositories and app categories

Package detailsv6.15.2

json_serializable

Automatically generate code for converting to and from JSON by annotating Dart classes.

AndroidiOSmacOSWindowsLinux
30-day downloads
4.3M
Likes
4K
Pub points
160

Install package

flutter pub add json_serializable

Package Overview

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

json_serializable is a code generation package that automatically creates serialization and deserialization logic for Dart classes, enabling seamless conversion between JSON and objects. By using annotations like @JsonSerializable, developers can generate boilerplate code for encoding and decoding data, reducing manual effort and potential errors. It integrates smoothly with Flutter and Dart projects across multiple platforms, supporting Android, iOS, macOS, Windows, and Linux. The generated code is efficient and type-safe, making it ideal for handling API responses and local data storage.

Use cases

  • Parsing API responses
  • Storing data locally
  • Handling configuration files
  • Serializing model objects
  • Building RESTful clients

Key features

  • Automatic code generation
  • Type-safe serialization
  • Supports nested objects
  • Custom field naming
  • Extensible via transformers

Suitable for

  • Flutter apps
  • Dart libraries
  • API-driven applications
  • Data modeling
  • Cross-platform development

Considerations

  • Requires build_runner
  • Needs annotation on each class
  • Generated code must be committed
  • Limited to JSON format
  • Build step required for updates

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Dart CI

Provides Dart Build System builders for handling JSON.

json_serializable Pub Package

The core package providing Generators for JSON-specific tasks.

Import it into your pubspec dev_dependencies: section.

json_annotation Pub Package

The annotation package which has no dependencies.

Import it into your pubspec dependencies: section.

checked_yaml Pub Package

Generate more helpful exceptions when decoding YAML documents using package:json_serializable and package:yaml.

Import it into your pubspec dependencies: section.

example

An example showing how to set up and use json_serializable and json_annotation.

Categories

Dependencies

Dependency list 12 items

Source repository

Projects using this package

Rankings