• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
I'm a web UI developer so JavaScript and JSON are commonly encountered. I prefer sublime text for editing files. Color-coding is built-in for JSON which helps catch syntax goofs. It's 60 bucks or free with very light nagware (a popup every 6 saves or so - I actually have a license but have been ignoring the nag on a new install for months). Like Notepad ++ it's lightweight but considerably less crash-prone. Also has support for regex find/replace which is awesome if you know regex. You can check your JSON changes here if you make non-trivial ones:

https://jsonlint.com/

There's also a CLI version you can run from a command line.

Some of the files that have to be working or the game would be busted actually have bad JSON syntax (missing commas or commas after the last item typically) so I'm not sure what the devs parse it with, but making sure your changes are correct should help avoid problems even if you fix a couple dev mistakes while you're at it. In some cases changes to the game's local DB are necessary to make stuff work. I haven't gotten around to looking at that yet.

If you have a little bit of programming/scripting familiarity and want to do something fancy with the JSON data, I recommend giving node.js a look. Very painless to install. Using it as as simple as putting JS in a file and typing "node myfile.js" in a command line. It's also really to experiment with JS in Chrome by right-clicking on a web page -> inspect element -> console tab. Try something like:

alert('hello world')

Node is here:

https://nodejs.org/en/

JSON is just vanilla javascript objects with strict formatting rules so it's really easy to read/manipulate with JS, but most languages have stuff for reading JSON at this point since it's become popular for configuration. Powershell and Python aren't bad options either. MDN is a good site reference if you want to go the JS route which is also handy for doing browser stuff.

JSON syntax:

{ } - This denotes a javascript object literal. AKA a dictionary in a lot of other languages. It's a sequence of name/value pairs like this:

{
"name1":'value1',
"name2":'value2'
}

Names should always be in double-quotes for JSON. Vanilla JS objects don't require them.
Multiple name/value pairs should be separated by commas, but don't leave a comma after the final value. I think that rule is relaxed in newer versions of JS for objects but not a good idea in JSON. Whitespace isn't supposed to matter but I suspect it does matter for these JSON files. By that I mean spaces and carriage returns so the example above could also be:

{ "name1":'value1', "name2":'value2' }

But I would speculate that whatever they parse their busted JSON files with probably also checks for carriage returns as a fallback to sort things out when commas are out of whack. They also make the code easier to read so it's worth following spacing conventions just to be safe.

Values are typically:
text/strings: 'like this' or "like this" or "Mike's string" or 'Mike\'s string' with the \ escaping the single-quote inside the string
numbers: 5 or 5.0197 , no quotes unless you want text/string things to happen with them (this can impact stuff like sorting in a spreadsheet)
another JS object literal e.g. { "subcategory1": { "name1":'value1', "name2":2 } }
booleans (true/false) - true or false, no quotes or it's just a string with the text true or false in it
or arrays/lists which are established with [ ] as in { "someNumbers":[1,3,6] }

Arrays by themselves:

[
'an atypical but valid array. They tend to repeat values from some kind of set',
5,
true,
'stuff',
{ "subcategory1": { "name1":'value1', "name2":2 } }
]

An array is just a list of stuff that you don't need to reference by name. If it's in an array it's more likely to be something where order/sortability, or the ability to rapidly check stuff like qualifying system tags for store inventories at a given planet is important. Arrays of objects with the same repeating names with different values are a bit like a database table or a spreadsheet.

You can nest { } and [ ] inside each other as deep as you want.
 
Last edited:
Best practice would be to leave it alone, but I doubt it'll screw up if you change it back. Just back up your edit, restore the original file and see if the game loads. If it does, you're probably good. If it doesn't, put the modded file back in.


In case anyone was wondering I did exactly this, and it worked. I’m now back to the stock json file but still have the starting mechs I wanted (FS, Urbie, both commandos and LRM locust.)