Support JSON binding with the JDK's built-in JSON API (`jdk.incubator.json`)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- java, json
- Ambito
- api, backend-api-design
Direzione di ricerca
Read the linked proposal and inspect the prototype’s JsonRecordHttpMessageConverter to understand the proposed mapping and constraints. Compare the reflection, generated, hybrid, and tree-only options for spring-web and spring-messaging; done means the project has a decided scope and approach, or has explained why this belongs in a separate library.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Use case
I want to build Spring MVC REST endpoints that read and write Java records as JSON without a third-party JSON library:
@PostMapping("/hello")
public HelloResponse hello(@RequestBody HelloRequest request) { ... }
The same records should also work as Kafka message payloads:
@KafkaListener(topics = "hello")
public void onHello(HelloRequest request) { ... }
JDK 28 ships an incubating JSON API (jdk.incubator.json) that parses JSON into a JsonValue tree and writes it back, but it does not map JSON to Java types.
Spring has HTTP and messaging converters for Jackson, Gson, JSON-B and Kotlin Serialization, but none for the JDK API.
Reasons for a JDK-only option:
- Fewer dependencies for applications that only need simple JSON.
- A smaller attack surface:
jackson-databindhas 86 advisories in OSV, 17 of them published in 2026. - GraalVM native images without reflection metadata for the JSON library.
What I have tried so far
A prototype on Spring Boot 4.1 / JDK 28-ea: https://github.com/drnow4u/springboot-jdk28-json
JsonRecordHttpMessageConverter, anAbstractHttpMessageConverter<Record>that maps JSON objects to and from records using reflection over record components (String, numeric and boolean types, nested records).- Malformed JSON or a wrong value type is mapped to
HttpMessageNotReadableException(400). - The JDK parser has no size limits and repeats the offending input in its error messages, so the converter limits the body size (
413) and shortens error messages. - Spring AOT already registers reflection hints for the records used in the controller signature, so option A below may work in a native image; this cannot be verified until GraalVM supports JDK 28.
Questions
The main design question is how the mapping should work:
- A. Reflection over record components (what the prototype does). No setup, but needs AOT hints for native images.
- B. Compile-time generated bindings (annotation processor), similar to Kotlin Serialization. No reflection, errors at compile time, but needs a processor on the build path.
- C. Hybrid: generated bindings when present, reflection otherwise.
- D. Tree types only: a converter for
JsonValue/JsonObject/JsonArray, with mapping left to applications or libraries.
Whichever option is chosen, the mapping would be shared by an HttpMessageConverter (spring-web) and a MessageConverter (spring-messaging, used by @KafkaListener); a Kafka Serializer/Deserializer would belong in Spring for Apache Kafka.
Would the Spring team consider any of these for Spring Framework, and which one? Or should this live in a separate library until the JDK API leaves incubation?
The full proposal, covering security, performance, native image and open questions, is here:
https://github.com/drnow4u/springboot-jdk28-json/blob/main/docs/proposal-jdk-json-binding.md
- Lingua principale
- Java
- Stelle
- 60.3k
- Fork
- 38.7k
- Merge medio
- 1g 1h
- PR unite (30g)
- 33
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di spring-projects/spring-framework
-
status: waiting-for-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 87/100
spring-projects/spring-framework#37613 ·
I maintainer di solito rispondono entro 1 giorno
-
`YamlProcessor.getFlattenedMap` with `includeEmpty` returns a `null` key for an empty root mappingForse di nuovo libera @erfannvb l’ha presa 13 giorni fa e non c’è nessuna pull request aperta. Apertastatus: waiting-for-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
spring-projects/spring-framework#37522 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
`WebClient` with default codecs drops `ProblemDetail` extension membersForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertastatus: waiting-for-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
spring-projects/spring-framework#37503 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
StandardApiVersionDeprecationHandler generates nonconforming Sunset HTTP datesForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertastatus: waiting-for-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
spring-projects/spring-framework#37486 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
FastByteArrayOutputStream input stream rejects valid skip(long) argumentsForse di nuovo libera @hickey-ai l’ha presa 16 giorni fa e non c’è nessuna pull request aperta. Apertastatus: waiting-for-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
spring-projects/spring-framework#37471 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di spring-projects/spring-framework
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 3 giorni
-
A proxy that fails to start logs a RejectedExecutionException stack trace from its shutdown hookApertafollow-up
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
Sanne/incus-spawn#1953 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
HexaHexes/ability-battlewills#37 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
Shweit/EtherealPortals#30 ·