How about using `replace`?

  JSON.parse(dataTableAsString.replace(/\'/g,"\""))

On Wed, May 30, 2012 at 11:07 AM, tobe <[email protected]> wrote:

> Hi everyone!
>
> I am using ASP NET with google chart API.
> I am filling a table like this:
>
> var data = google.visualization.arrayToDataTable([ ['Movie', 'Status'], 
> ["Movie
> 1", "On Sale"] ,
> ["Movie 2", "Sold out"] ,
> ["Movie 3", "Coming goon"]
> ]);
> Data is coming from a SQL Server Database.
>
> The problem is if I have for example a movie which name has single quote
> (') or double quote (").
> When I try to parse that, an error ocurred.
>
> I think I can use regular expressions to parse data without those
> characters.
>
> Do anyone know which regular expression should I use?
> I am not sure if I know all the characters / scenarios that can "break" my
> code.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-visualization-api/-/OfYKEloZvTkJ.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-visualization-api?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to