I have created a hash in java script and passing it to controller through Ajax request but
in controller i’m getting hash in string
{1100:{time:\"1\", mark:\"1\", difficulty_level:\"3\"}, 1108:{time:\"1\", mark:\"1\", difficulty_level:\"3\"}}
I have tried using JSON.parse but getting error JSON::ParserError: 710: unexpected token at
You should find a way to create a proper JSON from your JavaScript object, by using some JavaScript library (such as JSON-js), and
JSON.stringify(myObject). JSON requires all string-values (keys and values alike) to be surrounded by quotation marks.So in your case, the proper JSON would look like this (non-quote escaped):