How to style a JSON block in Github Wiki?

JsonGithubMarkdownWiki

Json Problem Overview


Is there a way to nicely format/style JSON code in Github Wiki (i.e Markdown preferred)?

Something like this with few colors (or bold) and correct indentation:

http://www.freeformatter.com/json-formatter.html#ad-output

Json Solutions


Solution 1 - Json

Some color-syntaxing enrichment can be applied with the following blockcode syntax

```json
Here goes your json object definition
```

Note: This won't prettify the json representation. To do so, one can previously rely on an external service such as jsbeautifier.org and paste the prettified result in the wiki.

Solution 2 - Json

```javascript
{ "some": "json" }
```

I tried using json but didn't like the way it looked. javascript looks a bit more pleasing to my eye.

Solution 3 - Json

2019 Github Solution

```yaml
{
   "this-json": "looks awesome..."
}
Result

enter image description here

If you want to have keys a different colour to the values, set your language as yaml

@Ankanna's answer gave me the idea of going through github's supported language list and yaml was my best find. (No other language had keys a different colour to values on github).

Also you can use comments in yaml with //

Solution 4 - Json

I encountered the same problem. So, I tried representing the JSON in different Language syntax formats.But all time favorites are Perl, js, python, & elixir.

This is how it looks.

The following screenshots are from the Gitlab in a markdown file. This may vary based on the colors using for syntax in MARKDOWN files.

JsonasPerl

JsonasPython

JsonasJs

JsonasElixir

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHP.View Question on Stackoverflow
Solution 1 - JsonnulltokenView Answer on Stackoverflow
Solution 2 - Jsonjc00keView Answer on Stackoverflow
Solution 3 - JsonJesse Reza KhorasaneeView Answer on Stackoverflow
Solution 4 - JsonAnkannaView Answer on Stackoverflow