From: Todd Walton Date: Mon, 10 Sep 2018 20:31:25 +0000 (-0400) Subject: clarify JSON standard non-compliance X-Git-Tag: 4.16~42^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3bfcbb88bf9bd45913a81c7ed3d3c01d0ce22ef5;p=i3%2Fi3 clarify JSON standard non-compliance Modified section on the layout file's non-compliance with the JSON standard. The section previously stated that having multiple top-level JSON texts is non-compliant. This isn't the case. It's just that most JSON parsers will treat that as if it is non-compliant. --- diff --git a/docs/layout-saving b/docs/layout-saving index e90ecada..f31b5e21 100644 --- a/docs/layout-saving +++ b/docs/layout-saving @@ -219,13 +219,15 @@ the window which matches any of the criteria. As an example: A layout file as generated by +i3-save-tree(1)+ is not strictly valid JSON: -1. Layout files contain multiple “JSON documents” on the top level, whereas the - JSON standard only allows precisely one “document” (array or hash). +1. Layout files contain multiple “JSON texts” at the top level. The JSON + standard doesn't prohibit this, but in practice most JSON parsers only + allow precisely one “text” per document/file, and will mark multiple texts + as invalid JSON. -2. Layout files contain comments which are not standardized, but understood by - many parsers. +2. Layout files contain comments which are not allowed by the JSON standard, + but are understood by many parsers. -Both deviations from the JSON standard are to make manual editing by humans +Both of these deviations from the norm are to make manual editing by humans easier. In case you are writing a more elaborate tool for manipulating these layouts, you can either use a JSON parser that supports these deviations (for example libyajl), transform the layout file to a JSON-conforming file, or