Add JSON example (#3995)

* Add JSON example

Not sure if this is a good or useful example case.

* Add license link

* Add link to source example

* Remove extra license link

As requested, only one link is necessary
master
Skubie Doo 2018-02-19 11:07:19 -05:00 committed by Ika
parent f0ce1556b5
commit 4347f481bb
1 changed files with 18 additions and 0 deletions

View File

@ -439,6 +439,24 @@ function getExample(parser) {
" }",
"}"
].join("\n");
case "json":
// Excerpted & adapted from Wikipedia, under the Creative Commons Attribution-ShareAlike License
// https://en.wikipedia.org/wiki/JSON#Example
return [
'{"allOn": "Single", "Line": "example",',
'"noSpace":true,',
' "quote": {',
" 'singleQuote': 'example',",
' "indented": true,',
" },",
' "phoneNumbers": [',
' {"type": "home",',
' "number": "212 555-1234"},',
' {"type": "office",',
' "trailing": "commas by accident"},',
" ],",
"}"
].join("\n");
default:
return "";
}