Backend: Decode/encode takes JSON as input