Ruby on Rails Saturday, December 29, 2018



On Saturday, December 29, 2018 at 5:48:31 AM UTC-5, Colin Law wrote:
On Sat, 29 Dec 2018 at 10:36, fugee ohu <fuge...@gmail.com> wrote:
>
> json_data = res.body.gsub(/^.+{/, "{").chomp(");")
> json = JSON.parse(json_data)
> JSON::ParserError: 765: unexpected token at '{\"pvid\":\"ff43f2dc-3f86-42a3-bfa8-49c117e9da6a\",\"scm-cnt\":\"1007.13482.95643.0\",

Why have you posted this?  You still have \" instead of "
As I said, look again at the spec of what a JSON string should look
like.  Until you have that there is no point feeding into parse()

Colin

Well it seems my response shouldn't contain the \" characters if it's json so It's not json it's js? because i already read that the string response is  jsonp which actually contains js, not json

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6d889ac9-86b1-4dc9-b1aa-68a91e87c5b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment