construct json objects programatically