unit-test-json-serialization

Installation
SKILL.md

Unit Testing JSON Serialization with @JsonTest

Overview

Provides patterns for unit testing JSON serialization and deserialization using Spring's @JsonTest and Jackson. Covers POJO mapping, custom serializers, field name mappings, nested objects, date/time formatting, and polymorphic types.

When to Use

  • Testing JSON serialization/deserialization of DTOs
  • Verifying custom Jackson serializers/deserializers
  • Validating @JsonProperty, @JsonIgnore, and field name mappings
  • Testing date/time format handling (LocalDateTime, Date)
  • Testing null handling and missing fields
  • Testing polymorphic type deserialization

Instructions

  1. Annotate test class with @JsonTest → Enables JacksonTester auto-configuration
  2. Autowire JacksonTester for target type → Provides type-safe JSON assertions
Related skills

More from giuseppe-trisciuoglio/developer-kit-claude-code

Installs
20
GitHub Stars
246
First Seen
Feb 21, 2026