convert to json
move to namespace to fix compile error on linux/gcc