Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
config:json [2014/11/27 00:54] – Use lexer filetype "Javascritp" to be more straightforward (but it's the same in the end) colombanwconfig:json [2015/04/08 23:38] (current) – Add a tip that Geany 1.25 has the filetype builtin colombanw
Line 1: Line 1:
 ====== JSON Filetype ====== ====== JSON Filetype ======
 +<WRAP center round tip 60%>
 +Starting with version 1.25, Geany has a built-in JSON filetype.
 +</WRAP>
 +
 JSON files are intended for serializing data objects, but are sometimes used as configuration files.  JSON syntax is mostly a subset of JavaScript syntax and therefore the JavaScript lexer can be used for it. JSON files are intended for serializing data objects, but are sometimes used as configuration files.  JSON syntax is mostly a subset of JavaScript syntax and therefore the JavaScript lexer can be used for it.
  
Line 53: Line 57:
  
 In Geany, go to the Build menu and 'Set Build Commands...' and use ''/usr/local/bin/check_json %f'' as the compile command, and ''([^:]+):([0-9]+)'' as the Error Regular Expression. In Geany, go to the Build menu and 'Set Build Commands...' and use ''/usr/local/bin/check_json %f'' as the compile command, and ''([^:]+):([0-9]+)'' as the Error Regular Expression.
 +
 +=== Pretty Printing ===
 +
 +Assuming you have Python installed, pretty printing (aka formatting) of JSON is very easy with Geany:
 +
 +  * Python is required (works with Python 2 and 3)
 +  * Configure Geany: Edit->Format->Send Selection to->Set Custom Commands
 +  * In the dialog add a new command and simply use: //python -mjson.tool//
 +
 +To use this, select some string in Geany and use Edit->Format->Send Selection to-><your configured command> and Geany will replace the string by the converted version.
 +Alternatively, you can use the shortcut Ctrl-<number> in case your command is one of the first three configured commands.
 +For details, read the [[http://www.geany.org/manual/#sending-text-through-custom-commands|documentation about Send Selection to commands]].
  
  
Print/export