💻 Passive-Aggressive JSON Validator
Get sassy feedback instead of robotic error messages when your JSON is broken.
// Install: npm install passive-aggressive-json-validator
const { validateJSON } = require('passive-aggressive-json-validator');
// Example usage with your broken JSON
const brokenJSON = `{
"name": 'John', // Oops, single quotes
"age": 30,
"hobbies": ["coding", "gaming"
}`;
try {
validateJSON(brokenJSON);
} catch (error) {
console.log(error.message);
// Outputs something like:
// "Single quotes? Really? JSON uses double quotes. Did you learn JSON from a Python tutorial?"
// "Missing closing bracket in array. Did you get distracted by a squirrel?"
}
// Working example with custom roasts
const validator = new PassiveAggressiveValidator({
roastLevel: 'medium', // 'mild', 'medium', or 'spicy'
includeSolutions: true
});
const result = validator.validate(yourJSONString);
if (!result.valid) {
console.log(result.roast);
console.log(result.suggestion);
}
The Problem: When JSON Validation Feels Like Gaslighting
Let's be real: JSON validation errors are the developer equivalent of your car's 'Check Engine' light. It tells you something's wrong, but gives you zero clues about whether it's a loose gas cap or your entire transmission just yeeted itself into the void. You get messages like 'Unexpected token' or 'Parse error on line 5'—vague, unhelpful, and dripping with the emotional warmth of a tax audit.
Why does this problem exist? Because the people who wrote JSON parsers were too busy being technically correct to consider the human cost. They gave us machines that speak in absolutes while we're out here, sleep-deprived, trying to remember if JSON uses single or double quotes (it's double, always double, but at 3 AM everything looks like a suggestion).
The absurdity peaks when you're debugging production issues. You've got a service down, Slack is blowing up, and your validator's contribution to the crisis is: 'SyntaxError: Unexpected string'. Unexpected to whom? To you? To the parser? To God? It's like asking for directions and being told 'you can't get there from here'—technically true but spiritually devastating.
The Solution: Validation with Personality Disorder
I built JSON Validator But With Sass because sometimes what you need isn't just technical correctness—it's emotional accountability. This tool does exactly what it says on the tin: it validates JSON, but with the attitude of a disappointed English teacher who caught you using 'their' instead of 'there' in your thesis.
How does it work? Under the hood, it's using the same parsing logic as any other validator (because we're not monsters—we want actual validation). But instead of outputting sterile error messages, it runs your mistakes through a filter of sarcasm, shame, and occasional encouragement. Think of it as pair programming with Gordon Ramsay: harsh, but you'll never make the same mistake twice.
Despite the humor, this is actually useful. The roasts are contextual—they point to specific lines, explain what you did wrong in human terms, and sometimes even suggest fixes. It's like having a senior developer looking over your shoulder, except this one doesn't charge $200/hour and won't judge you for debugging in your pajamas.
How to Use It: Your Guide to Emotional Damage
Installation is straightforward because even this tool understands that setup shouldn't be another source of pain:
npm install -g json-validator-but-with-sass
# or if you're feeling spicy
pip install json-validator-but-with-sassBasic usage is exactly what you'd expect, but with more emotional baggage:
json-sass-validate broken.json
# Output might include:
# "Line 3: Oh look, an extra comma.
# Were you hoping JSON would just... ignore it? Like your responsibilities?"Here's a taste of the actual code that makes the magic happen (from the main validation logic):
function generateRoast(errorType, line, context) {
const roasts = {
'UNEXPECTED_TOKEN': [
`Line ${line}: Did you even read the spec, or are you just typing random brackets?`,
`Line ${line}: '${context}'? Really? That's what you're going with?`
],
'MISSING_COMMA': [
`Line ${line}: Forgot something? Like maybe... A COMMA?`,
`Line ${line}: Objects need commas between properties.
This isn't a suggestion, it's the law.`
]
};
const options = roasts[errorType] || [`Line ${line}: I don't even know what you did.`];
return options[Math.floor(Math.random() * options.length)];
}Check out the full source code on GitHub to see all the beautifully petty error messages we've prepared for your debugging pleasure.
Key Features: The Arsenal of Attitude
- Validates JSON with extreme prejudice: It checks your JSON so thoroughly, it might as well be going through your browser history.
- Replaces standard errors with roasts: Instead of "Unexpected token," you get "Line 3: Did you even read the spec, or are you just typing random brackets?"
- Optional --tough-love flag: For when you really need to be put in your place. Adds extra harshness for repeated offenders.
- Color-coded output for shame levels: Yellow for minor oopsies, red for "you should probably take a break and think about your life choices."
- Actually helpful suggestions: Buried beneath the sarcasm are genuine tips for fixing your JSON. We're mean, not useless.
Conclusion: Better Debugging Through Shame
JSON Validator But With Sass won't just validate your JSON—it'll validate your life choices. Or at least your choice to put a comma where a bracket should be. The benefits are clear: you get actual debugging help wrapped in entertainment, you'll remember your mistakes better (because shame is an excellent teacher), and you might actually laugh during a debugging session instead of contemplating career changes.
So try it out: https://github.com/BoopyCode/json-validator-but-with-sass. Your JSON will be validated, your mistakes will be roasted, and your 2 AM debugging sessions will finally have the dramatic flair they deserve.
Remember: it's not passive-aggressive if it's helping you become a better developer. It's just... aggressively helpful.
Quick Summary
- What: A JSON validator that replaces sterile error messages with dramatic, passive-aggressive commentary to make debugging actually bearable.
💬 Discussion
Add a Comment