Passing and returning value in JSON format