Store the whole file as a string, decode it and store the values in you variables. Show the json your using. your using the -> incorrect, thats for objects not arrays, json_decode() returns an associative array if the next param is true. ref_id will hold a string thats comma separated.
dataset_f.json
{
"sender":"am@email.com",
"receiver":"ak@email.com",
"msg_id":"msg1_am@email.com",
"subject":"Group Discussion",
"references":["msg1_aman@email.com","msg1_s@email.com","msg1_v@email.com"]
}
php code
$json = file_get_contents("dataset_f.json");
$data = json_decode($json, true);
// here depends on the json
$ref_id = ( ( is_array( $data["references"] ) ? implode(", ", $data["references"]) : $data["references"] ) ); // array to string
$msg_id = $data["msg_id"];
$sender = $data["sender"];
$receiver = $data["receiver"];
$subject = $data["subject"];