Check this code. It gives you the clear solution of JSON parse error. It commonly happen by the newlines and the space between json key start and json key end
data_val = data_val.replace(/[\n\s]{1,}\"/g, "\"")
.replace(/\"[\n\s]{1,}/g, "\"")
.replace(/[\n]/g, "\\n")