FasterXML / FasterXML/jackson-databind
Add mechanism, annotation, to handle "JSON-in-JSON" case
- Lenguaje dominante
- Java
- Estrellas
- 3.7k
- Forks
- 1.5k
- Merge medio
- 3 d 6 h
- PR fusionados (30 d)
- 28
Descripción
One common (anti?-)pattern that exists is for a JSON-String valued property to contain JSON-encoded value; effectively using double-encoding. It would be nice to be able to support such case automatically with just an annotation, like `@JsonDoubleEncoded` or something.
What this would do would be allow usage like:
``` java
public class Funny {
public int id;
@JsonDoubleEncoded
public Map attrs;
```
but produce something where `attrs` is actually JSON String, and not JSON Object; encoded further as JSON.
For extra points this should also work for other data-formats; but most likely would have to be limited to "in-kind" encoding as there isn't a good way to access other backends at the point where this is needed. For trans-coding (like JSON in XML, XML in JSON, JSON in Protobuf, whatever) custom handler would still be needed.
Note: although technically, at this point, producing JSON can actually be done from all other data-formats (due to original being JSON-centric), I don't think we should rely on this since going forward this invariant might not hold, and we want to lessen, not strengthen this dependency.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.