JSON API parsing error, single quotes used for errors like "['BAD CSRF']"

My JSON parser fails when retrieving certain errors, so far I’ve only expierenced it with “[‘BAD CSRF’]” being returned when using the /groups/{group_id}/members.json endpoint (as single-quotes for string delimiters is improper JSON). Quick search in github revealed the following:

https://github.com/discourse/discourse/blob/122fb8025d23030019fb8897e678d44fd6571e73/app/assets/javascripts/discourse/lib/ajax.js.es6#L72
https://github.com/discourse/discourse/blob/fdf749770bfbc868660cc37cf8e77ce57805b7fa/app/controllers/application_controller.rb#L32

I imagine there might be some other areas with improper manually-formatted JSON as well.

2 Likes

Mind sending a PR through to fix both spots?

3 Likes

https://github.com/discourse/discourse/pull/4763

3 Likes