Added functions to build key and json.

Signed-off-by: Terence <teryan2006@gmail.com>