json: Refactor the APIs

Refactor the `json` library taking feedback of @privat, @Morriar and @xymus into account. Also, correct some bugs related to JSON encoding/decoding and remove ad hoc escaping routines.

TODO: Support Unicode escaping.

Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
pas d'indentation ni de barrière, donc pas reconnus comme du code.