refactor, use json-lib to construct json string