google/json_serializable.dart
68.1
Adequate · 17 November 2026
7.5k
lines of production code
Dart
primary language
5
measurements over time
What this system is
Features
Add checked\_yaml usage example
The checked\_yaml package now includes an example demonstrating how to decode YAML configuration files into a strongly-typed Dart class using json\_serializable. The example shows a Configuration class with required and optional fields, illustrating the use of checkedYamlDecode to parse YAML content from a file path or raw string, and validating that unrecognized keys are disallowed.
_checked\yaml/example · high confidence
Add example demonstrating JSON Schema generation
The example directory now includes a \Person\ class that uses the \createJsonSchema: true\ option to generate a JSON Schema alongside the standard serialization code. This allows users to see how to access the generated schema via the \jsonSchema\ static constant, which is exposed as a constant map conforming to the JSON Schema Draft 2020-12 specification.
_json\serializable/example · high confidence
Add example library demonstrating advanced serialization patterns
The example library now includes a comprehensive set of Dart source files and their generated counterparts that demonstrate advanced \json\_serializable\ capabilities. These examples cover using \JsonConverter\ for custom type encoding (such as mapping \DateTime\ to epoch integers), handling generic response classes with runtime type inspection, serializing nested list structures via custom converters, and supporting generic type parameters in classes like \Tuple\<T, S\>\ using \genericArgumentFactories\. A static JSON literal example is also provided to show how to embed and serialize embedded data directly.
example/lib · high confidence
Added CI automation script for package tasks
A new \tool/ci.sh\ script has been added to automate continuous integration tasks across multiple packages. Generated by \mono\_repo\ v6.7.2, this script iterates through packages listed in the \PKGS\ environment variable and executes specific tasks such as analysis, formatting, and testing (including Chrome-based tests). It intelligently switches between \dart\ and \flutter\ commands if the Flutter SDK is detected in a package's \pubspec.yaml\, ensuring consistent CI behavior for both Dart and Flutter repositories.
tool · high confidence
Automated README generation and test matrix builder tooling
The project now includes internal tool scripts to automate documentation and testing. A new \readme\_builder.dart\ generates the \README.md\ from a template, automatically populating supported types, collection types, and map key types, and linking to the correct \json\_annotation\ documentation version. Additionally, a \test\_builder.dart\ (renamed from \builder\) creates variant test files by applying configuration options (such as \anyMap\, \checked\, \exclude\_null\, and \explicitToJson\) to a base kitchen sink, enabling comprehensive testing of different generator configurations without manual duplication.
_json\serializable/tool · high confidence
Automated README generation with new documentation examples
The documentation build process now uses a dedicated tool to generate README.md from a template and Dart source examples, ensuring the docs stay in sync with the code. This change introduces new example files demonstrating advanced features such as enhanced enum serialization with \JsonEnum.valueField\, custom type conversions via \JsonKey\ and \JsonConverter\, and strict integer validation. It also adds documentation for the new JSON Schema generation capability (\createJsonSchema\), providing users with clear, code-backed examples for these features.
_json\serializable/tool/readme · high confidence
Introduce checked\_yaml library for validated YAML decoding
The checked\_yaml library is introduced, providing a \checkedYamlDecode\ function that parses YAML content and validates it against a constructor. This allows applications to decode YAML into strongly-typed Dart objects with detailed error reporting, including specific location information for missing keys, unrecognized keys, or unsupported values via the new \ParsedYamlException\ class.
_checked\yaml/lib · high confidence
Behavioural changes
Consolidated JSON annotation library exports
The json\_annotation package now provides a single entry point that exports all annotation classes and helper functions. Users can import the main library to access core annotations like JsonSerializable and JsonEnum, as well as helper utilities for enum conversion, key/value mapping, and custom type conversion (JsonConverter).
_json\annotation/lib · high confidence
Refactored runtime helpers and exception classes for JSON deserialization
The \json\_annotation\ package has reorganized its internal runtime support code into dedicated helper files (\allowed\_keys\_helpers.dart\, \checked\_helpers.dart\, \enum\_helpers.dart\) and updated the core annotation classes. This change introduces new exception types—\UnrecognizedKeysException\, \MissingRequiredKeysException\, and \DisallowedNullValueException\—to provide clearer error messages when deserializing JSON with strict key validation or null constraints. The \CheckedFromJsonException\ class has been refactored to include a \badKey\ flag and improved message handling, while the \JsonKey\ annotation now supports \explicitJsonNullWhenNonNullField\ for PATCH-style tri-state semantics and \readValue\ for custom map reading logic. Additionally, the \JsonEnum\ annotation allows configuring field renaming and value fields for enhanced enums, and the \JsonSerializable\ annotation now generates code using these new helper functions for checked creation and key validation.
_json\annotation/lib/src · high confidence
Refactored type helpers and configuration into a modular structure
The internal implementation of the code generator has been reorganized to improve maintainability and support new features. Configuration logic for \@JsonSerializable\ and \@JsonKey\ annotations has been extracted into dedicated \config\_types.dart\ files (\ClassConfig\, \KeyConfig\), replacing previous inline parsing. Type serialization and deserialization logic is now split into granular, single-responsibility helper classes (e.g., \BigIntHelper\, \DateTimeHelper\, \DurationHelper\, \EnumHelper\, \IterableHelper\, \MapHelper\, \RecordHelper\, \JsonConverterHelper\, etc.) located in the \type\_helpers\ directory. This change also introduces support for Dart 3 Record types via \RecordHelper\, adds a \BigIntHelper\ for \BigInt\ serialization, and refactors \DateTime\ handling to respect the \dateTimeUtc\ configuration option. The \TypeHelper\ interface and context objects have been updated to pass richer configuration context to these helpers.
_json\_serializable/lib/src/type\helpers · high confidence
Restructured public API exports and builder configuration
The library's public API has been reorganized to improve clarity and modularity. The main \json\_serializable.dart\ file now explicitly exports only the core generator classes (\JsonEnumGenerator\, \JsonLiteralGenerator\, \JsonSerializableGenerator\), while \type\_helper.dart\ serves as the dedicated entry point for all type helper implementations and context classes. Additionally, \builder.dart\ now provides a cleaner interface for \build\_runner\ integration, including improved error handling for invalid configuration options and the removal of internal \run\_only\_if\_triggered\ flags from user-facing config parsing.
_json\serializable/lib · high confidence
json\_serializable now requires Dart 3.8 and validates the json\_annotation dependency version
The code generator now enforces a minimum Dart SDK version of 3.8.0, as the generated code utilizes null-aware elements introduced in that release. Additionally, a new dependency check ensures that the \json\_annotation\ package is present in the project's dependencies with a minimum version of 4.12.0, warning users if the constraint is missing or too low.
_json\serializable/lib/src · high confidence
Test coverage
Added comprehensive test suite for json\_serializable; Added shared test utilities and mono\_repo configuration; Added test source definitions for JSON serialization configuration scenarios; Added tests for JSON literal generation with edge-case strings; Added tests for YAML configuration parsing and build verification; Added tests for checked\_yaml; Added tests for default value handling in json\_serializable; Added tests for example code; Added tests for generic class serialization and generic argument factories; Integration tests for new serialization features and regression fixes; Kitchen sink tests now cover multiple serialization configurations.
Dependencies
Migrate to Dart 3.9 SDK and Dart workspaces
The project has updated its minimum SDK constraint to ^3.9.0 across all packages and enabled Dart's native workspace resolution. This migration consolidates the monorepo structure, allowing shared dependency management and unified tooling for packages such as json\_serializable, json\_annotation, and checked\_yaml.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 60.2 → 68.1 (+7.9)
- Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 91.1 → 90.8 (-0.3)
- Architecture 97.3 → 97.5 (+0.2)
- Maturity 40.6 → 52.3 (+11.7)
- Readiness 67.2 → 77.1 (+9.9)
- Security 77.3 → 77.3 (0.0)
- Performance 100.0 → 100.0 (0.0)
New (6)
- Documentation: no build, run or usage example (json_annotation/README.md)
- Edited copies of one member (3 members, 3+ corresponding lines) (json_serializable/lib/src/default_container.dart)
- Edited copy of a member (19 corresponding lines) (json_serializable/lib/src/type_helpers/generic_factory_helper.dart)
- Edited copy of a member (38 corresponding lines) (json_serializable/lib/src/type_helpers/json_converter_helper.dart)
- Repeated repair: json_serializable/lib/src/json_key_utils.dart (json_serializable/lib/src/json_key_utils.dart)
- Repeated repair: json_serializable/lib/src/schema_helper.dart (json_serializable/lib/src/schema_helper.dart)
Changes since last survey
- 1 commits — 0 feature/other, 1 fixes
By area
- json_serializable/test — 1 commit
Notable commits
- fix: fix: format Record constructor defaults from constantInitializer AST (#1628)
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
google/json_serializable.dart was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 17 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 72bc0441e8fa41683b9a95fad8df0df4c428e9f4 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.85+preprod-eba6548ac50f.