spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

Allow using spring's object mapper

Open worldtiki opened this issue 1 week ago • 2 comments
trafficstars

Summary

Introduces Spring Boot auto-configuration for customizable Jackson ObjectMapper instances used throughout Spring AI, addressing JSON parsing issues with LLM-generated content.

Key Changes

  • Added new spring-ai-autoconfigure-json-parser module with auto-configuration
  • Provides two specialised ObjectMapper beans:
    • jsonParserObjectMapper - Lenient parsing for LLM responses
    • modelOptionsObjectMapper - Configurable parsing for model options

Configuration

New properties available under spring.ai.json.*:

  • Control unescaped characters, date formats, empty string handling
  • Configure unknown property and empty bean behavior
  • Handle enum coercion for API compatibility

I believe this fixes https://github.com/spring-projects/spring-ai/issues/2494

worldtiki avatar Nov 09 '25 18:11 worldtiki