lundi 24 octobre 2016

Ruby on Rails - JSON parse error unexpected token

I read json file after load it into json but i got error JSON::ParserError unexpected token at, i couldn't json parse.Below i mentioned what i got output after file read

Here my code,

file = File.read("sample.json") 
hash = JSON.load(file)

after read my json file,

"{\"rename\"=>[{\"from\"=>\"TTTC\", \"to\"=>\"AAAB\"}, {\"from\"=>\"AAAA\", \"to\"=>\"Description\"}, {\"from\"=>\"AAAC\", \"to\"=>\"test\"}], \"drop\"=>{\"fields\"=>[\"AAAG\", \"AAAH\"]}}"

Aucun commentaire:

Enregistrer un commentaire