Fixing undefined value for json in client response