instance method String#unfilterJSON

View source on GitHub →

String#unfilterJSON([filter = Prototype.JSONFilter]) → String

Strips comment delimiters around Ajax JSON or JavaScript responses. This security method is called internally.

Example
'/*-secure-\n{"name": "Violet", "occupation": "character", "age": 25}\n*\/'.unfilterJSON()
// -> '{"name": "Violet", "occupation": "character", "age": 25}'