Validating JSON File - EwyBoy/OreTweaker GitHub Wiki
How to Ensure Your OreTweaker.json File is Valid
If you are experiencing issues with OreTweaker and none of the ore generation you have configured seems to work, it is important to ensure that your JSON file is valid and properly configured. Small typos and syntax errors can occur, and they can be hard to spot. Below is a quick guide to help you identify and correct these mistakes.
Error
If the mod crashes with an error message: Malformed JSON its because the one of the files is not properly formatted. Follow the guide below and take note of the file name and line numbers displayed in the error message.
How to Validate a JSON File:
-
Copy and paste your JSON file into a JSON validator such as jsonlint.com. It will validate your JSON and highlight any issues in red text.
-
Read the JSON file line by line slowly, paying close attention to the syntax: `[ ] { } , ``, etc. Alternatively, you can ask someone else to review it since it can be difficult to spot errors after staring at the same file for a long time.
-
Use a proper text editor tool such as VS Code, Notepad++, Atom, Sublime Text, or any of the online tools available. These tools often provide syntax highlighting and formatting options that can help identify errors.
-
Refer to the template files generated by OreTweaker in the
config/oretweaker/templates
folder for guidance. These templates contain examples that can serve as references or be directly copied into your OreTweaker.json file. You can use them side by side as a comparison to identify any mistakes.
JSON Text Editors:
Here are some recommended JSON text editors that offer features specifically tailored for working with JSON files:
Using a dedicated JSON text editor can greatly enhance your experience when working with JSON files, providing features like syntax highlighting, auto-completion, and error checking.
Reference Templates
OreTweaker generates several templates with examples that can be used as references or copied directly into the OreTweaker.json file. These templates can be found in the config/oretweaker/templates
folder of your mod installation. You can use them side by side as a comparison to identify any mistakes and ensure that your JSON file follows the correct structure and syntax.