formatting json in appropriate format