Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Include the name of the type being serialized as the first property in the serialized JSON

Chiusa
#492 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

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
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
julia
Ambito
data

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di JuliaIO/JSON.jl

Tutte le issue di JuliaIO/JSON.jl

Issue simili

Altre issue su Julia

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.