Skip to content

Errors & Debugging

JSSON has a unique approach to errors — instead of cryptic messages, you get help from friendly (well, mostly friendly) creatures! 🧙‍♂️👺

JSSON’s error system has three characters, each responsible for a different phase:

CharacterPhaseWhat They Check
Lex Goblin 👺LexingInvalid characters, unterminated strings
Parse Wizard 🧙‍♂️ParsingSyntax errors, unexpected tokens
Transpiler Gremlin 👹TranspilationType errors, undefined references

The Lex Goblin catches errors during tokenization — when JSSON reads your file character by character.

Error:

Lex goblin: 1:5 — Illegal character: '@'

What it means: You used a character that JSSON doesn’t recognize.

Example:

name = João@Silva // ❌ @ is not allowed without quotes

Fix:

name = "João@Silva" // ✅ Use quotes for special characters

Error:

Lex goblin: 2:10 — Unterminated string

What it means: You started a string with " but never closed it.

Example:

name = "João
age = 25 // ❌ Missing closing quote

Fix:

name = "João" // ✅ Close the string
age = 25

The Parse Wizard catches syntax errors — when your JSSON structure is invalid.

Error:

Parse wizard: 3:8 — Unexpected token: expected '=', got '{'

What it means: The parser expected one thing but found another.

Example:

user
{ // ❌ Missing assignment operator
name = João
}

Fix:

user { // ✅ Add the assignment (or just put { on same line)
name = João
}

Error:

Parse wizard: EOF — Expected '}', got EOF

What it means: You opened a { but never closed it.

Example:

user {
name = João
age = 25
// ❌ Missing }

Fix:

user {
name = João
age = 25
} // ✅ Close the object

Error:

Parse wizard: 2:15 — Expected ']', got ','

What it means: Array syntax is incorrect.

Example:

colors = [ red, blue, green,, ] // ❌ Double comma

Fix:

colors = [ red, blue, green ] // ✅ Remove extra comma

Error:

Parse wizard: 3:5 — Template expects 3 fields, got 2

What it means: A template row doesn’t match the template definition.

Example:

users [
template { name, age, email }
João, 25 // ❌ Missing email
]

Fix:

users [
template { name, age, email }
João, 25, "joao@test.com" // ✅ All 3 fields
]

The Transpiler Gremlin catches semantic errors — when your JSSON is syntactically correct but logically wrong.

Error:

Transpiler gremlin: 5:12 — Undefined reference: 'config.port'

What it means: You’re trying to access a property that doesn’t exist.

Example:

server {
host = localhost
}
url = server.host + ":" + config.port // ❌ config doesn't exist

Fix:

server {
host = localhost
port = 8080 // ✅ Define port
}
url = server.host + ":" + server.port // ✅ Use server.port

Error:

Transpiler gremlin: 3:10 — Cannot perform operation '+' on boolean and string

What it means: You’re trying to combine incompatible types.

Example:

active = true
message = "Status: " + active // ❌ Can't add boolean to string

Fix:

active = "true" // ✅ Make it a string
message = "Status: " + active

Problem:

title = Software Engineer // ❌ Space without quotes

Solution:

title = "Software Engineer" // ✅ Use quotes for spaces

Problem:

user {
"name": "João", // ❌ JSON syntax
"age": 25,
}

Solution:

user {
name = João // ✅ JSSON syntax
age = 25
}

Problem:

colors = [ red blue green ] // ❌ Missing commas

Solution:

colors = [ red, blue, green ] // ✅ Add commas

Problem:

colors = [ red, blue, green, ] // ❌ Trailing comma

Solution:

colors = [ red, blue, green ] // ✅ Remove trailing comma

Problem:

Terminal window
jsson -i config.json # ❌ Wrong extension

Solution:

Terminal window
jsson -i config.jsson # ✅ Use .jsson extension

Error messages always include line and column numbers:

Parse wizard: 15:8 — Unexpected token
↑ ↑
line column

Go to that exact location in your file!

If you see EOF (End Of File) errors, you probably forgot to close something:

user {
name = João
config {
theme = dark
// ❌ Missing } for config
// ❌ Missing } for user

Tip: Use an editor with bracket matching!

Build your JSSON file step by step:

Terminal window
# Start simple
echo 'name = João' > test.jsson
jsson -i test.jsson # ✅ Works
# Add more
echo 'age = 25' >> test.jsson
jsson -i test.jsson # ✅ Still works
# Keep adding until you find the problem

Comment out sections to isolate the problem:

user {
name = João
age = 25
}
// database {
// host = localhost
// port = 5432
// }
api {
url = "https://api.example.com"
}

Mixed quotes can cause issues:

name = "João' // ❌ Mismatched quotes
name = "João" // ✅ Matching quotes

All JSSON errors follow this format:

[Character]: [Location] — [Message]

Example:

Lex goblin: config.jsson:15:8 — Illegal character: '@'
↑ ↑ ↑
Character Location Message

Location formats:

  • 15:8 — Line 15, column 8
  • config.jsson:15:8 — File, line, column
  • EOF — End of file

If you’re stuck:

  1. Read the error message carefully — it usually tells you exactly what’s wrong
  2. Check the line number — go to that exact location
  3. Look at examples in the Syntax Reference
  4. Compare with working code — what’s different?
  5. Ask for help on GitHub Issues

Now that you know how to debug JSSON:

Don’t fear the errors — the goblins, wizards, and gremlins are here to help! 🧙‍♂️👺👹