# Help with json linter

**URL:** <https://discourse.cataclysmdda.org/t/help-with-json-linter/17773>\
**Category:** The Toolbox\
**Created:** [December 6, 2018, 11:38pm UTC](https://discourse.cataclysmdda.org/t/help-with-json-linter/17773 "2018-12-06T23:38:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheMurderUnicorn](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/themurderunicorn/32/5706_2.png) [@TheMurderUnicorn](https://discourse.cataclysmdda.org/u/TheMurderUnicorn)\
**Post date:** [December 6, 2018, 11:38pm UTC](https://discourse.cataclysmdda.org/t/help-with-json-linter/17773/1 "2018-12-06T23:38:33Z")

</div>

Alright, so, I recently submitted a PR and then had to edit it multiple times because I suck and don’t format things the right way (yeah, I use tabs, hate me).

Anyway, I saw a lot of talk about a linter on Github but I didn’t really know what such a thing was. Is there one in the source code? If there is, I have no idea how to make it work.

But right, so I googled around and found [http://dev.narc.ro/cataclysm/format.html](http://dev.narc.ro/cataclysm/format.html)

Is that the current web linter? Because I punched in a couple of my json from a mod I’ve been working on and all it did was correct them, rather than pointing out the errors so I could learn what the issue was. It also appeared to be inconsistent.

Specifically, I asked it to correct this entry:

```auto
[
  {
    "type" : "overmap_special",
    "id" : "Prepper Cache",
    "overmaps" : [
      { "point":[0,0,0], "overmap": "cache_main_north"},
	  { "point":[0,0,-1], "overmap": "cache_under_north"}
    ],
    "locations" : ["forest"], 
    "city_distance" : [20, -1],
    "city_sizes" : [0, 12],
    "occurrences" : [0, 3],
    "rotate" : false, 
    "flags" : ["CLASSIC"]
  }
]
```

and it just mashed all of “overmaps” onto one line, which is not how the core game files look.

So I was just wondering if that was up to date, or if there’s a different web-based linter I’m unaware of. Or, even, if someone can point me at a downloadable version of the linter I’m supposed to be using.

---

<div class="post-metadata">

**Author:** ![mlangsdorf](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/mlangsdorf/32/2462_2.png) [@mlangsdorf](https://discourse.cataclysmdda.org/u/mlangsdorf)\
**Post date:** [December 7, 2018, 1:49am UTC](https://discourse.cataclysmdda.org/t/help-with-json-linter/17773/2 "2018-12-07T01:49:46Z")

</div>

There’s a JSON formatter in tools/format/json\_formatter.cgi if you compile from source. And when I ran that JSON through it, I got:

```auto
[
  {
    "type": "overmap_special",
    "id": "Prepper Cache",
    "overmaps": [{ "point": [ 0, 0, 0], "overmap": "cache_main_north" }, { "point": [0, 0, -1], "overmap": "cache_under_north" } ],
    "locations": ["forest"],
    "city_distance": [20, -1],
    "city_sizes": [0, 12],
    "occurrences": [0, 3],
    "rotate": false,
    "flags": ["CLASSIC"]
  }
]

```

General rules of CDDA formating are documented in doc/JSON\_STYLE.md ([https://github.com/CleverRaven/Cataclysm-DDA/blob/482191fe75f0e58e66e0d6045fc86028758c7d76/doc/JSON\_STYLE.md](https://github.com/CleverRaven/Cataclysm-DDA/blob/482191fe75f0e58e66e0d6045fc86028758c7d76/doc/JSON_STYLE.md)). The tricky bit is that short lists and objects go on a single line:

```auto
"responses": [{ "talk_topic": "TALK_DONE", "text": "Bye." }],

```

But long lists and objects get split:

```auto
"responses": [
   {
     "talk_topic": "TALK_DONE",
     "text": "Well, that was really helpful. You're definitely a shining example of post<cataclysm> humanity, you <swear> <swear> <swear>. I hope you <swear> die. Bye."
  }
],

```

The line length is supposed to be 100 characters, but the linter is unpredictable.

---

<div class="post-metadata">

**Author:** ![TheMurderUnicorn](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/themurderunicorn/32/5706_2.png) [@TheMurderUnicorn](https://discourse.cataclysmdda.org/u/TheMurderUnicorn)\
**Post date:** [December 7, 2018, 3:02am UTC](https://discourse.cataclysmdda.org/t/help-with-json-linter/17773/3 "2018-12-07T03:02:08Z")

</div>

Well, I’m having a lot of problems compiling the game. I’ll just take your word for it and get around to working that out later because I’m frustrated.

But I read the JSON\_STYLE.md and I understand why it put the overmaps on a single line. Thanks for the input and I’ll mark this as a solution.
