Hands-on task
Broken JSON config
The app won't start: its config /etc/app/config.json contains a syntax error (a trailing comma). Fix the JSON so it becomes valid (checked with jq).
- json
- jq
- config syntax
- validation
- trailing comma
Hands-on task
The app won't start: its config /etc/app/config.json contains a syntax error (a trailing comma). Fix the JSON so it becomes valid (checked with jq).
JSON is a strict format: unlike JavaScript objects it does not allow a trailing comma after the last element of an array or the last field of an object before the closing bracket. A validator like jq or python3 -m json.tool doesn't just say "invalid" — it points to the approximate position, the line and character where the parser broke; and it often shows the position at the spot right after the problematic character, so you have to look at the neighbouring lines too. The idea of the task: fix structured configs not by eye but through a parser — first it localises the error, then you use it again to confirm that after the fix the file parses again with a zero exit code.