Agent skill

Unit Test JSON Serialization

by giuseppe-trisciuoglio in giuseppe-trisciuoglio/developer-kit

Provides patterns for unit testing JSON serialization/deserialization with Jackson and @JsonTest.

MITAuto-check: notesTesting & QA

Install Unit Test JSON Serialization

skills CLI
$ npx skills add giuseppe-trisciuoglio/developer-kit --skill unit-test-json-serialization -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install giuseppe-trisciuoglio/developer-kit unit-test-json-serialization --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/giuseppe-trisciuoglio/developer-kit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/developer-kit-java/skills/unit-test-json-serialization .claude/skills/unit-test-json-serialization && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
unit-test-json-serialization
GitHub stars
357
Token cost
~2.6k tokens
SKILL.md length
470 words
Files
1
Skills in repo
115
Repo updated
First seen
Licence
MIT

At a glance

Provides patterns for unit testing JSON serialization/deserialization with Jackson and @JsonTest.

  • Works in 7 steps: Annotate test class with @JsonTest →… → Autowire JacksonTester for target type →… → Test serialization → Call… → …
  • Testing JSON serialization
  • SKILL.md covers Overview, When to Use, Instructions and Examples, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Unit Test JSON Serialization is an agent skill from giuseppe-trisciuoglio/developer-kit. Provides patterns for unit testing JSON serialization/deserialization with Jackson and @JsonTest. Validates JSON mapping, custom serializers, date formats, and polymorphic types. Use when testing JSON serialization, validating custom serializers, or writing JSON unit tests in Spring Boot applications.

Its SKILL.md is about 2.6k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Unit testing. It works with Spring Boot. The repository describes itself as: Modular plugin marketplace for Claude Code and agentic CLIs, with validated, spec-driven skills, agents, commands, and workflows for Java, TypeScript, Python, PHP, AWS, and AI. The licence is MIT.

When your agent uses it

  • Testing JSON serialization
  • Validating custom serializers
  • Writing JSON unit tests in Spring Boot applications

Example prompts

  • “Use the unit-test-json-serialization skill to provide patterns for unit testing JSON serialization/deserialization with Jackson and @JsonTest”
  • “/unit-test-json-serialization”

Requirements

  • Pre-approved tools (allowed-tools): Read, Write, Bash, Glob, Grep

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Annotate test class with @JsonTest → Enables JacksonTester auto-configuration
  2. Autowire JacksonTester for target type → Provides type-safe JSON assertions
  3. Test serialization → Call json.write(object) and assert JSON paths with extractingJsonPath*
  4. Test deserialization → Call json.parse(json) or json.parseObject(json) and assert object state
  5. Validate round-trip → Serialize, then deserialize, verify same data (if object is properly comparable)
  6. Test edge cases → Null values, missing fields, empty collections, invalid JSON
  7. Add validation checkpoints: After each assertion, verify the test fails meaningfully with wrong data

What it can do on your machine

Read from SKILL.md and the folder at commit fe73fb3. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Bash
    • Glob
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are java, xml and kotlin).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • fasterxml.github.io
    • docs.spring.io

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Unit Test JSON Serialization loads about 2.6k tokens when it runs. Until then it costs about 83 tokens; SKILL.md has 470 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~83
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Write, Bash, Glob, Grep

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from giuseppe-trisciuoglio/developer-kit at commit fe73fb3, republished under its MIT licence (© giuseppe-trisciuoglio). 470 words, ~2,564 tokens.

Download SKILL.mdSave it as .claude/skills/unit-test-json-serialization/SKILL.md (or your agent's skills folder).
name
unit-test-json-serialization
description
Provides patterns for unit testing JSON serialization/deserialization with Jackson and `@JsonTest`. Validates JSON mapping, custom serializers, date formats, and polymorphic types. Use when testing JSON serialization, validating custom serializers, or writing JSON unit tests in Spring Boot applications.
allowed-tools
Read, Write, Bash, Glob, Grep

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
  3. Test serialization → Call json.write(object) and assert JSON paths with extractingJsonPath*
  4. Test deserialization → Call json.parse(json) or json.parseObject(json) and assert object state
  5. Validate round-trip → Serialize, then deserialize, verify same data (if object is properly comparable)
  6. Test edge cases → Null values, missing fields, empty collections, invalid JSON
  7. Add validation checkpoints: After each assertion, verify the test fails meaningfully with wrong data

Examples

Maven Setup
xml
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-json</artifactId>
</dependency>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-test</artifactId>
  <scope>test</scope>
</dependency>
Gradle Setup
kotlin
dependencies {
  implementation("org.springframework.boot:spring-boot-starter-json")
  testImplementation("org.springframework.boot:spring-boot-starter-test")
}
Basic Serialization and Deserialization
java
@JsonTest
class UserDtoJsonTest {

  @Autowired
  private JacksonTester<UserDto> json;

  @Test
  void shouldSerializeUserToJson() throws Exception {
    UserDto user = new UserDto(1L, "Alice", "alice@example.com", 25);
    JsonContent<UserDto> result = json.write(user);

    result
      .extractingJsonPathNumberValue("$.id").isEqualTo(1)
      .extractingJsonPathStringValue("$.name").isEqualTo("Alice")
      .extractingJsonPathStringValue("$.email").isEqualTo("alice@example.com")
      .extractingJsonPathNumberValue("$.age").isEqualTo(25);
  }

  @Test
  void shouldDeserializeJsonToUser() throws Exception {
    String json_content = "{\"id\":1,\"name\":\"Alice\",\"email\":\"alice@example.com\",\"age\":25}";
    UserDto user = json.parse(json_content).getObject();

    assertThat(user.getId()).isEqualTo(1L);
    assertThat(user.getName()).isEqualTo("Alice");
    assertThat(user.getEmail()).isEqualTo("alice@example.com");
    assertThat(user.getAge()).isEqualTo(25);
  }

  @Test
  void shouldHandleNullFields() throws Exception {
    String json_content = "{\"id\":1,\"name\":null,\"email\":\"alice@example.com\"}";
    UserDto user = json.parse(json_content).getObject();
    assertThat(user.getName()).isNull();
  }
}
Custom JSON Properties
java
public class Order {
  @JsonProperty("order_id")
  private Long id;

  @JsonProperty("total_amount")
  private BigDecimal amount;

  @JsonIgnore
  private String internalNote;
}

@JsonTest
class OrderJsonTest {

  @Autowired
  private JacksonTester<Order> json;

  @Test
  void shouldMapJsonPropertyNames() throws Exception {
    String json_content = "{\"order_id\":123,\"total_amount\":99.99}";
    Order order = json.parse(json_content).getObject();
    assertThat(order.getId()).isEqualTo(123L);
    assertThat(order.getAmount()).isEqualByComparingTo(new BigDecimal("99.99"));
  }

  @Test
  void shouldIgnoreJsonIgnoreFields() throws Exception {
    Order order = new Order(123L, new BigDecimal("99.99"));
    order.setInternalNote("Secret");
    assertThat(json.write(order).json).doesNotContain("internalNote");
  }
}
Nested Objects
java
public class Product {
  private Long id;
  private String name;
  private Category category;
  private List<Review> reviews;
}

@JsonTest
class ProductJsonTest {

  @Autowired
  private JacksonTester<Product> json;

  @Test
  void shouldSerializeNestedObjects() throws Exception {
    Product product = new Product(1L, "Laptop", new Category(1L, "Electronics"));
    JsonContent<Product> result = json.write(product);

    result
      .extractingJsonPathNumberValue("$.category.id").isEqualTo(1)
      .extractingJsonPathStringValue("$.category.name").isEqualTo("Electronics");
  }

  @Test
  void shouldDeserializeNestedObjects() throws Exception {
    String json_content = "{\"id\":1,\"name\":\"Laptop\",\"category\":{\"id\":1,\"name\":\"Electronics\"}}";
    Product product = json.parse(json_content).getObject();
    assertThat(product.getCategory().getName()).isEqualTo("Electronics");
  }

  @Test
  void shouldHandleListOfNestedObjects() throws Exception {
    String json_content = "{\"id\":1,\"reviews\":[{\"rating\":5},{\"rating\":4}]}";
    Product product = json.parse(json_content).getObject();
    assertThat(product.getReviews()).hasSize(2);
  }
}
Date/Time Formatting
java
@JsonTest
class DateTimeJsonTest {

  @Autowired
  private JacksonTester<Event> json;

  @Test
  void shouldFormatDateTimeCorrectly() throws Exception {
    LocalDateTime dt = LocalDateTime.of(2024, 1, 15, 10, 30, 0);
    json.write(new Event("Conference", dt))
      .extractingJsonPathStringValue("$.scheduledAt").isEqualTo("2024-01-15T10:30:00");
  }
}
Custom Serializers
java
public class CustomMoneySerializer extends JsonSerializer<BigDecimal> {
  @Override
  public void serialize(BigDecimal value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
    gen.writeString(value == null ? null : String.format("$%.2f", value));
  }
}

@JsonTest
class CustomSerializerTest {

  @Autowired
  private JacksonTester<Price> json;

  @Test
  void shouldUseCustomSerializer() throws Exception {
    json.write(new Price(new BigDecimal("99.99")))
      .extractingJsonPathStringValue("$.amount").isEqualTo("$99.99");
  }
}
Polymorphic Deserialization
java
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
@JsonSubTypes({
  @JsonSubTypes.Type(value = CreditCard.class, name = "credit_card"),
  @JsonSubTypes.Type(value = PayPal.class, name = "paypal")
})
public abstract class PaymentMethod { }

@JsonTest
class PolymorphicJsonTest {

  @Autowired
  private JacksonTester<PaymentMethod> json;

  @Test
  void shouldDeserializeCreditCard() throws Exception {
    String json_content = "{\"type\":\"credit_card\",\"id\":\"card123\"}";
    assertThat(json.parse(json_content).getObject()).isInstanceOf(CreditCard.class);
  }

  @Test
  void shouldDeserializePayPal() throws Exception {
    String json_content = "{\"type\":\"paypal\",\"id\":\"pp123\"}";
    assertThat(json.parse(json_content).getObject()).isInstanceOf(PayPal.class);
  }
}

Best Practices

  • Test serialization AND deserialization for complete coverage
  • Verify JSON paths individually rather than comparing full JSON strings
  • Test null handling explicitly — null fields may be included or excluded depending on @JsonInclude
  • Use extractingJsonPath* methods for precise field assertions
  • Test round-trip: serialize an object, deserialize the JSON, verify the result matches
  • Validate edge cases: empty strings, empty collections, deeply nested structures
  • Group related assertions in a single test for clarity
Show full SKILL.md (225 more words)Show less

Constraints and Warnings

  • @JsonTest loads limited context: Only JSON-related beans; use @SpringBootTest for full Spring context
  • Jackson version: Ensure annotation versions match the Jackson version in use
  • Date formats: ISO-8601 is default; use @JsonFormat for custom patterns
  • Null handling: Use @JsonInclude(Include.NON_NULL) to exclude nulls from serialization
  • Circular references: Use @JsonManagedReference/@JsonBackReference to prevent infinite loops
  • Immutable objects: Use @JsonCreator + @JsonProperty for constructor-based deserialization
  • Polymorphic types: @JsonTypeInfo must correctly identify the subtype for deserialization to work

Debugging Workflow

When a JSON test fails, follow this workflow:

Failure SymptomCommon CauseHow to Verify
JsonPath assertion failsField name mismatchCheck @JsonProperty spelling matches JSON key
Null expected but got value@JsonInclude(NON_NULL) configuredVerify annotation on field/class
Deserialization returns wrong typeMissing @JsonTypeInfoAdd type info property to JSON or configure subtype mapping
Date format mismatchFormat string incorrectConfirm @JsonFormat(pattern=...) matches expected string
Missing field in output@JsonIgnore or transient modifierCheck field for @JsonIgnore or transient keyword
Nested object is nullInner JSON missing or malformedLog parsed JSON; verify inner structure matches POJO
JsonParseExceptionMalformed JSON stringValidate JSON syntax; check for unescaped characters

Validation checkpoint after fixing: Re-run the test — if it passes, write a complementary test for the opposite case (e.g., if you fixed null handling, add a test for non-null values to prevent regression).

References

© giuseppe-trisciuoglio, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/developer-kit-java/skills/unit-test-json-serialization of giuseppe-trisciuoglio/developer-kit.

Open the folder on GitHubat commit fe73fb3

Compare with similar skills

Unit Test JSON Serialization next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Unit Test JSON Serialization compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Unit Test JSON Serialization this skillgiuseppe-trisciuoglio/developer-kit357—~2.6kAutomated safety check: NotesMIT
Hilla TestAI-Unified-Process/marketplace142—~3.9kAutomated safety check: WarnApache-2.0
321 Frameworks Spring Boot Testing Unit Testsjabrena/plinth447—~952Automated safety check: PassApache-2.0
Coverage CheckAI-Unified-Process/marketplace142—~2.7kAutomated safety check: PassApache-2.0
Groovy 5 Developer Guideapache/grails-core2.9k—~3kAutomated safety check: PassApache-2.0
Java Rulessoftspark/ai-toolkit179—~3.1kAutomated safety check: PassApache-2.0

Similar skills

  • Hilla Test

    AI-Unified-Process/marketplace

    Creates tests for Hilla use cases on both sides of the browser boundary: Vitest + React Testing Library tests for the React/TypeScript view (with the generated endpoint clients mocked) and Spring…

    142 GitHub stars~3.9k tokensUpdated 5 days ago
    Testing & QAAuto-check: warnings
  • A skill your agent uses when you need to write unit tests for Spring Boot applications — including pure unit tests with @ExtendWith(MockitoExtension.class) for @Service/@Component, slice tests with…

    447 GitHub stars~952 tokensUpdated 3 days ago
    Testing & QAAuto-check passed
  • Coverage Check

    AI-Unified-Process/marketplace

    Audits an already-written use case (UC-XXX) or test case (TC-XXX) against its specification and reports a coverage matrix: which main success scenario steps, alternative flows, business rules…

    142 GitHub stars~2.7k tokensUpdated 5 days ago
    Testing & QAAuto-check passed
  • Groovy 5 Developer Guide

    apache/grails-core

    Guidance for Groovy 5 work in Grails projects: syntax, closures, traits, DSLs, metaprogramming, Spock tests, static compilation and Java 21 integration.

    2.9k GitHub stars~3k tokensUpdated today
    DevelopmentAuto-check passed
  • Java Rules

    softspark/ai-toolkit

    Java coding rules: style, patterns, security, testing. An agent skill from softspark/ai-toolkit.

    179 GitHub stars~3.1k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed
  • Jest Testing Patterns

    ChrisWiles/claude-code-showcase

    Jest patterns for React Native style tests: TDD discipline, mock factory functions, module and GraphQL hook mocking, custom render helpers and anti-patterns to avoid.

    6.1k GitHub starsUsed in 7 repos~1.5k tokens
    Testing & QAAuto-check passed

More from giuseppe-trisciuoglio/developer-kit

All 115 skills in this repo
  • Nestjs Drizzle Crud Generator

    giuseppe-trisciuoglio/developer-kit

    Generates complete CRUD modules for NestJS applications with Drizzle ORM.

    357 GitHub stars~1.3k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Actuator

    giuseppe-trisciuoglio/developer-kit

    Provides patterns to configure Spring Boot Actuator for production-grade monitoring, health probes, secured management endpoints, and Micrometer metrics across JVM services.

    357 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Crud Patterns

    giuseppe-trisciuoglio/developer-kit

    Provides and generates complete CRUD workflows for Spring Boot 3 services.

    357 GitHub stars~2.5k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Security JWT

    giuseppe-trisciuoglio/developer-kit

    Provides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based…

    357 GitHub stars~3.9k tokensUpdated 1 mo ago
    Auto-check: notes
  • AWS CLI Beast

    giuseppe-trisciuoglio/developer-kit

    Provides advanced AWS CLI patterns for managing EC2, Lambda, S3, DynamoDB, RDS, VPC, IAM, and CloudWatch.

    357 GitHub stars~1.7k tokensUpdated 1 mo ago
    Auto-check: notes
  • PR Review Comments

    giuseppe-trisciuoglio/developer-kit

    Posts review findings from a JSON file as inline comments on a GitHub Pull Request, attaching each comment to its file and line.

    357 GitHub stars~1k tokensUpdated 1 mo ago
    Auto-check: notes

Works with

Categories

Questions about Unit Test JSON Serialization

What does Unit Test JSON Serialization do?

Provides patterns for unit testing JSON serialization/deserialization with Jackson and @JsonTest. Unit Test JSON Serialization is an agent skill from giuseppe-trisciuoglio/developer-kit. Provides patterns for unit testing JSON serialization/deserialization with Jackson and @JsonTest.

When should I use Unit Test JSON Serialization?

Unit Test JSON Serialization fits situations like: testing JSON serialization; validating custom serializers; writing JSON unit tests in Spring Boot applications.

How do I install Unit Test JSON Serialization in Claude Code?

Run `npx skills add giuseppe-trisciuoglio/developer-kit --skill unit-test-json-serialization -a claude-code`. Or copy the skill folder (plugins/developer-kit-java/skills/unit-test-json-serialization in giuseppe-trisciuoglio/developer-kit) into .claude/skills/unit-test-json-serialization in your project. Claude Code loads it when a task matches its description.

How do I install Unit Test JSON Serialization in Codex?

Run `npx skills add giuseppe-trisciuoglio/developer-kit --skill unit-test-json-serialization -a codex`. Or copy the skill folder (plugins/developer-kit-java/skills/unit-test-json-serialization in giuseppe-trisciuoglio/developer-kit) into .agents/skills/unit-test-json-serialization in your project. Codex loads it when a task matches its description.

Can I use Unit Test JSON Serialization in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add giuseppe-trisciuoglio/developer-kit --skill unit-test-json-serialization -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/unit-test-json-serialization, .gemini/skills/unit-test-json-serialization, .github/skills/unit-test-json-serialization and .opencode/skills/unit-test-json-serialization in your project.

What does Unit Test JSON Serialization need to run?

SKILL.md names no scripts, command-line tools or credentials: Unit Test JSON Serialization is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Write, Bash, Glob, Grep.

Does Unit Test JSON Serialization access the network?

SKILL.md names 2 domains. As links in the text: fasterxml.github.io and docs.spring.io. This is read from the text; nothing was executed.

Is Unit Test JSON Serialization safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Unit Test JSON Serialization use?

Unit Test JSON Serialization is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Unit Test JSON Serialization use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Unit Test JSON Serialization?

Skills that share tags, products or a category with Unit Test JSON Serialization: Hilla Test (AI-Unified-Process/marketplace, 142 stars), 321 Frameworks Spring Boot Testing Unit Tests (jabrena/plinth, 447 stars), Coverage Check (AI-Unified-Process/marketplace, 142 stars) and Groovy 5 Developer Guide (apache/grails-core, 2.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Unit Test JSON Serialization?

giuseppe-trisciuoglio (a GitHub user) maintains it in giuseppe-trisciuoglio/developer-kit, which has 357 GitHub stars. The repository holds 115 skills in this directory. The repository was last updated on September 10, 2026.

Source: giuseppe-trisciuoglio/developer-kit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.