FelixKratz / SketchyBar

A highly customizable macOS status bar replacement

Home Page:https://felixkratz.github.io/SketchyBar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Single quotes are being escaped in JSON serialization

zemzelett opened this issue · comments

Hi there,

i was dabbling with my bar config yesterday and noticed some error arising from parsing the JSON output of sketchybar --query with jq:

jq: parse error: Invalid escape at line 124, column 98

This error message came from a value i provided to a click_script property:

click_script="open -a 'System Preferences'"

Changing this to the following made the error disappear:

click_script="open -a \"System Preferences\""

The problem with the first one is, that the apostrophe is being escaped during serialization since the following commit: 14c6381

I can't tell, why that has been introduced but the apostrophe is a character that must not be escaped according to RFC 7159 Section 7.

Sadly, jq does not parse the rest of the JSON due to the error being thrown.

Again, i'm not sure what led to the decision of escaping apostrophes but, in my opinion, this should either be fixed by (preferably) reverting the above commit or by adding something to the documentation hinting towards this behavior.

Agreed, reverted commit 14c6381 and included in v2.19.6