Dear all,

my application users shall be able to provide multiple json documents
(files and urls) which I'd like to marshall into one structure.
Additionally these json documents may have different versions. I know how
to marshal a document into a version specific struct if I know the format
version before (for simplicity of this example I don't handle errors):
https://play.golang.org/p/ixVI5CzPqFP

What I would like (in the example the village field was renamed to cities )
is a struct of type ModelV2 with all four values merged in Cities.

Is there a best practice for a backwards compatible behavior which:

   - identifies the json format version of each document
   - skips that document if it is higher than the supported format version
   in my application
   - merges supported format versions into ONE struct

Of course I have to implement the semantics on my own but how can I
approach the topic?

thanks

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CALWqRZog1iVW3ovJKVwqmXEuKFLCN9b5FTT-s36TAcMaHrtiwA%40mail.gmail.com.

Reply via email to