Using decoder and encoder on stream of JSON data