changed variable name "$json" to "$msg"