0

I have a hashes of JSON generated by php application , which i want to read in my rails controller. Is there any way can i convert this json in hashes again , so that i can able to read it.

json_from_php = "{'coms':[{'com':{'title':'kk dd','guid':'http:\/\/tes.name\/?p=02'}},{'com':{'title':'sdsdsdsd dsds','guid':'http:\/\/tes.name\/?p=06'}},{'com':{'title':'PHPTVDB: Using PHP ','guid':'http:\/\/tes.name\/?p=4'}},{'com':{'title':'Plugins','guid':'http:\/\/tes.name\/?p=08'}},{'com':{'title':'vvv','guid':'http:\/\/tes.name\/?p=2218'}},{'com':{'title':'dsds sdsds ','guid':'http:\/\/tes.name\/?p=12'}},{'com':{'title':'Represent ','guid':'http:\/\/tes.name\/?p=5'}},{'com':{'title':'ZebraTable','guid':'http:\/\/tes.name\/?page_id=4'}},{'com':{'title':'rr Plugin','guid':'http:\/\/tes.name\/?p=2'}},{'com':{'title':'dasd asdasd !','guid':'http:\/\/tes.name\/?p=1'}}]}"

#ss = JSON.parser(json_from_php)

error info : JSON::ParserError (757: unexpected token at '{'coms':[{'com':{

Reference https://davidwalsh.name/web-service-php-mysql-xml-json

xlm
  • 6,854
  • 14
  • 53
  • 55
Qmr
  • 64
  • 1
  • 7

1 Answers1

0
ss = ActiveSupport::JSON.decode(json_from_php) solved this issue
Qmr
  • 64
  • 1
  • 7