Added JSONEncoder and JSONDecoder

Users may be interested in subclassing them, and they should not
intermix different implementations, so let's provide them with
implementation agnostic classes.

Change-Id: I63ecd5dbbf78089d9e5c43ca5895c748eb23f070