make it more encoding/json like

Signed-off-by: Wang Zhen <lazybetrayer@gmail.com>
add test

Signed-off-by: Wang Zhen <lazybetrayer@gmail.com>
travis

Signed-off-by: Wang Zhen <lazybetrayer@gmail.com>
more tests

Signed-off-by: Wang Zhen <lazybetrayer@gmail.com>