Code cleanup, using customized json encoder/decoder

This allows the Document Models to encode/decode any type that implements the json (Un)Marhshal functions and allows the struct to embed other structs.