So.. finally found what was wrong...

The client library error was thrown after two "regexes" that remove the 
handler function from the response string: 

 c = c.replace(/^[\s\S]*google\.visualization\.Query\.setResponse\(/g, ""),
 c = c.replace(/\);[\s]*$/g, ""),

The last of them, removes ");" from the end of the response string, so it 
seems a ";" at the end of the string is needed to make it work.

I missed this in the examples 
<https://developers.google.com/chart/interactive/docs/dev/implementing_data_source#examples>
 , 
but the first two boxes here 
<https://developers.google.com/chart/interactive/docs/dev/implementing_data_source#json-response-format>
 omit 
it. Left feedback.

Thanks for reading :)



On Thursday, February 4, 2021 at 9:05:25 PM UTC-3 Claudio wrote:

> PS: reqId is properly taken from the query parameter, I just wrote "0" in 
> the object for an example.
>
> On Thursday, February 4, 2021 at 8:59:24 PM UTC-3 Claudio wrote:
>
>> Hi, I am testing an endpoint as a data source. Its raw response now is:
>>
>>
>> google.visualization.Query.setResponse({"status":"ok","table":{"rows":[{"c":[{"v":1.0}]},{"c":[{"v":3.0}]}],"cols":[{"id":"Col1","type":"number"}]},"reqId":"0"})
>>
>> But when the response is processed after query.send(), I get the error: 
>> "Unexpected token ) in JSON at position 121".
>>
>> But, as far as I can tell, the JSON format is as specified in the 
>> documentation (with the detail of quotes around names because I interpret 
>> this is proper for "strict" JSON). 
>>
>> What could be going wrong ?
>>
>> Thanks in advance!
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/14495e62-5eaa-44c2-b414-6fda5def550fn%40googlegroups.com.

Reply via email to