Include the name of the type being serialized as the first property in the serialized 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
- 35/100
Direzione di ricerca
The issue names no files, tests, or entry points. Start by reviewing JSON.jl's existing struct serialization and deserialization APIs, then determine how type metadata and constructor-based recovery should be specified. Done means the feature's format, supported types, recovery behavior, and tests are agreed and implemented.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Including the name of a struct type when serializing a struct seems to me to be an obvious thing to want to do, yet I see no way to do it in this package. After all, a serialization like
{
"modifiers": [
{
"level": 6
},
{
"level": 7
},
{
"level": 7
},
]
}
is meaningless unless one knows what is being modified.
I suggest that there be some way to specify that the JSON serialization for a given type of struct include a field named something like "__type" whose value is the name of the type as a string.
Deserialization of such JSON to reconstruct the struct would require some additional support from a constructor. Perhaps something like JSON.recover_struct(json) would construct a Symbol from the "__type" value and use that as a Val specializer to find the programmer specified constructor function.
- Lingua principale
- Julia
- Stelle
- 359
- Fork
- 117
- Merge medio
- 1g 12m
- PR unite (30g)
- 45
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 JuliaIO/JSON.jl
-
Comment supportApertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
JuliaIO/JSON.jl#343 · 3 commenti · 9 reazioni ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di JuliaIO/JSON.jl
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
bmad-sim/BeamTracking.jl#382 ·
I maintainer di solito rispondono entro 1 giorno
-
Typo in the Adjoint sectionAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
-
Using the test generatorAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno