Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
config:json [2013/09/11 09:39] – replace "filetypes_extensions.conf" by "filetype_extensions.conf" (remove 's' from "filetype") cyrille37 | config:json [2014/11/27 00:45] – Suggest to derive from the JavaScript (C) filetype, not YAML colombanw | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== JSON Filetype ====== | ====== JSON Filetype ====== | ||
- | JSON files are intended for serializing data objects, but are sometimes used as configuration files. | + | JSON files are intended for serializing data objects, but are sometimes used as configuration files. |
Add this to the '' | Add this to the '' | ||
Line 17: | Line 17: | ||
And create a new filedef named '' | And create a new filedef named '' | ||
<file properties filetypes.JSON.conf> | <file properties filetypes.JSON.conf> | ||
- | [styling] | + | [styling=C] |
- | default=default | + | |
- | number=number | + | |
- | string=string | + | |
- | word=word | + | |
- | identifier=identifier, | + | |
[keywords] | [keywords] | ||
Line 28: | Line 23: | ||
[settings] | [settings] | ||
- | lexer_filetype=YAML | + | lexer_filetype=C |
extension=json | extension=json | ||
- | comment_single= | + | mime_type=application/ |
[indentation] | [indentation] | ||
- | width=2 | + | #width=4 |
# 0 is spaces, 1 is tabs, 2 is tab & spaces | # 0 is spaces, 1 is tabs, 2 is tab & spaces | ||
- | type=0 | + | #type=1 |
</ | </ | ||
Line 43: | Line 38: | ||
<file bash / | <file bash / | ||
- | #!/bin/bash | + | #!/bin/sh |
if which python >/ | if which python >/ | ||
- | python -m json.tool <$1 2>&1 >/ | + | python -m json.tool <"$1" |
- | | sed ' | + | | sed ' |
elif which perl >/ | elif which perl >/ | ||
- | perl -MJSON -e 'local $/; | + | perl -MJSON -e 'local $/; |
- | |sed ' | + | |sed ' |
else | else | ||
echo "No known JSON parsers found" >&2 | echo "No known JSON parsers found" >&2 |