Created encode/decode functions for JSON internal communication