encode JSON into a Doc instead of a Builder