Developer10 min read

How to Use JSON Validator Online — Step-by-Step Guide

Free JSON Validator online — validate, beautify and analyze json with error line numbers and stats. Step-by-step guide with tips. 100% free, works on mobile....

JSON Validator — Free Online Validate, beautify and analyze JSON with error line numbers and stats Tool on SabTools.in
JSON Validator — Free Online Validate, beautify and analyze JSON with error line numbers and stats Tool on SabTools.in

Try this tool now — 100% free, no signup required

Open Tool

A Razorpay webhook fires at 2:47 AM. Your Node.js service at a Bangalore fintech startup throws SyntaxError: Unexpected token } in JSON at position 487. Production is down, on-call is you, and the only clue is a 12KB payload dumped into CloudWatch. You need to find one misplaced comma — fast. That is the exact moment a good JSON validator stops being a "nice developer utility" and becomes the difference between a 5-minute fix and a 45-minute incident.

The JSON Validator on SabTools runs entirely in your browser, flags the exact line and column of the parse error, pretty-prints the fixed output, and shows structural stats (keys, depth, array sizes) so you can audit payloads without pasting sensitive data into some random US-hosted service. If you work with payment gateways, GST APIs, Aadhaar eKYC responses, or just messy third-party webhooks, this guide walks through how to actually use it — with the kind of real payloads Indian developers deal with every day.

Why JSON breaks more often than you'd think in Indian production systems

Most JSON errors in Indian codebases come from a small set of recurring sources. If you've worked at a Razorpay/PayU integration, a Flipkart seller API, or a government portal (Income Tax e-filing, GSTN, UIDAI sandbox), you've probably seen all of these:

  • Trailing commas — perfectly legal in JavaScript objects, instant death in JSON. Developers copy-paste a config from a .js file into a .json file and ship it.
  • Single quotes instead of double quotes — Python's print(dict) output looks like JSON but isn't. A junior dev at a Hyderabad SaaS firm pastes it into a config and the parser rejects it.
  • Unescaped characters in Indian addresses — a merchant name like "Sharma's General Store, Pune" with an unescaped apostrophe inside double quotes breaks the whole payload.
  • Unicode mishandling — Devanagari, Tamil, or Bengali characters in customer names ("राहुल शर्मा") that got double-encoded somewhere between your MySQL database and the API response.
  • Invalid numbers — leading zeros in a PIN code ("pincode": 006001) or phone numbers written as numbers instead of strings, losing the leading zero.
  • Truncated payloads — a webhook body cut off at 8KB because someone's nginx client_max_body_size was too low.

Paste any of these into the validator and you'll get an error message pinned to a line number, not a vague "parse failed." That specificity is the whole point.

Walking through a real Razorpay webhook payload

Here's a trimmed webhook body — the kind that lands on your /api/razorpay-webhook endpoint when a customer in Jaipur pays ₹2,499 for a subscription:

{
  "entity": "event",
  "event": "payment.captured",
  "contains": ["payment"],
  "payload": {
    "payment": {
      "entity": {
        "id": "pay_MkV8aK2nQ3rPqL",
        "amount": 249900,
        "currency": "INR",
        "status": "captured",
        "method": "upi",
        "vpa": "rahul.sharma@okhdfcbank",
        "email": "rahul@example.in",
        "contact": "+919812345670",
        "notes": {
          "gst_number": "08AABCU9603R1ZM",
          "state": "Rajasthan",
        }
      }
    }
  }
}

Paste that into the JSON Validator and it will flag line 17 — the trailing comma after "Rajasthan". The stats panel will also tell you the object has 4 nesting levels, 12 keys, and the amount field is 249900 — remember Razorpay amounts are in paise, so that's ₹2,499.00. Catching that convention early prevents the classic "why did we charge the customer ₹2.49 instead of ₹249?" bug.

Once the JSON is valid, the beautifier formats it with 2-space indentation (configurable to 4-space or tab) so you can actually read it. For deeper formatting work and syntax highlighting while you edit live, the JSON Formatter is the companion tool — use the validator to find errors, then switch to the formatter for ongoing editing.

GST, PAN, Aadhaar: validating the data, not just the syntax

A valid JSON document can still contain garbage data. The validator confirms your payload parses; it does not confirm that "gst_number": "08AABCU9603R1ZM" is a real 15-character GSTIN in the correct format. For that, you pair the JSON check with field-level regex rules. A few patterns every Indian backend dev should keep handy:

  • GSTIN (15 chars): ^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$ — the first two digits are the state code (08 = Rajasthan, 27 = Maharashtra, 29 = Karnataka).
  • PAN: ^[A-Z]{5}[0-9]{4}[A-Z]$ — the fourth character encodes the holder type (P=individual, C=company, H=HUF, F=firm).
  • Aadhaar: 12 digits, but UIDAI prohibits storing or displaying the full number — mask the first 8 digits in logs. Validate format, don't log the value.
  • UPI VPA: ^[a-zA-Z0-9.\-_]{2,256}@[a-zA-Z]{2,64}$ — rahul.sharma@okhdfcbank, 9812345670@ybl.
  • Indian phone: ^\+91[6-9]\d{9}$ — mobile numbers start with 6, 7, 8, or 9 after the country code.

Build and debug these patterns in the Regex Tester with live match highlighting before baking them into your validation layer. A common mistake at smaller Indian startups is writing one giant regex, deploying it, and realising six months later it rejects valid GSTINs from newer state codes. Test with real sample data first.

The stats panel: what those numbers actually tell you

When you paste a valid JSON blob, the validator shows a stats block with counts for objects, arrays, strings, numbers, booleans, nulls, total keys, and maximum nesting depth. These aren't vanity metrics — they catch real production issues:

  • Max depth > 6: your API is over-nested. A GSTN return filing response with 11 levels of nesting is a code smell — your consumers will hate parsing it, and you'll break the AWS Lambda response size limit sooner than you think.
  • Key count in the thousands: you're probably shipping an entire database table in one response. Paginate. A Kota edtech company once shipped a 2.4MB JSON on every page load because they forgot to paginate their "list of all students" endpoint.
  • Array lengths wildly uneven: a Flipkart seller catalog export where one product has 47 images and the next has zero usually means missing default handling somewhere upstream.
  • Mixed types in arrays: [1, "2", 3, null, "4"] — the validator shows the mix; your consumer code will blow up on the first unexpected type.

Treating the stats block as a quick "health check" catches structural problems during development, before they become 500 errors in production at midnight.

Everything stays in your browser — a real concern, not a marketing line

Indian fintech, healthtech, and government-adjacent companies are increasingly bound by DPDP Act obligations and RBI data-localisation rules. Pasting a production payload containing customer PAN, UPI handles, or transaction amounts into a random SaaS JSON validator is, at minimum, a bad habit and potentially a compliance incident.

The SabTools validator parses JSON client-side using the browser's native JSON.parse with a wrapper that captures line/column information from the error object. Nothing leaves your tab. You can verify this by opening DevTools → Network before pasting — there's no outbound request with your payload. For a developer at Zerodha or Razorpay handling actual customer data, that distinction matters more than any UI polish.

Practical implication: you can safely paste a 500KB webhook from your staging environment without opening a security ticket. If you're ever unsure about a tool's data handling, the Network tab is your friend — and a habit worth building into every "free online validator" you try.

Common error messages, decoded

The raw JSON.parse errors across browsers are slightly different, but the validator normalises them. Here's what the common ones actually mean:

  • "Unexpected token } in JSON at position N" — usually a trailing comma right before the }. Delete the comma.
  • "Unexpected string in JSON at position N" — a missing comma between two key-value pairs. Common after copy-pasting a block.
  • "Unexpected end of JSON input" — the payload is truncated. Check nginx/Cloudflare body size limits, or your logging system cutting off long lines.
  • "Unexpected token ' in JSON" — single quotes. You've pasted a Python dict or JavaScript object literal, not JSON. Replace all ' with " — but watch out for apostrophes inside strings (Sharma's Store).
  • "Expected double-quoted property name" — your keys are unquoted (name: "Rahul" instead of "name": "Rahul"). Again, JavaScript, not JSON.
  • "Unexpected token N in JSON" where N looks like NaN or Infinity — JSON doesn't support these. Your serializer is leaking JavaScript number quirks. Fix it at source.

The line/column pointer saves the hunt. On a 400-line formatted payload, "error at line 287, column 14" turns a 20-minute scan into a 10-second fix.

Workflows where the validator fits in

A few places this tool earns its keep in a typical Indian developer's week:

  1. Debugging webhook payloads: copy the raw body from CloudWatch / Datadog / your log aggregator, paste, fix, re-send through Postman to your staging endpoint.
  2. Cleaning up API responses for documentation: beautify a messy minified blob so your Swagger/OpenAPI examples are readable.
  3. Validating config files before deployment: config.json, package.json, Terraform state files, tsconfig.json — one trailing comma breaks your CI pipeline.
  4. Exam/placement prep: students at IIIT Hyderabad or VIT prepping for backend interviews often need to hand-write JSON schemas on whiteboards. Validating their practice payloads catches habits early.
  5. Government portal data exports: the Income Tax portal's JSON utility for ITR filing, GST return JSON exports, and EPFO's UAN data dumps all produce JSON that occasionally has quirks worth inspecting.

If your work involves scheduled jobs that produce or consume JSON — nightly GST reconciliations, daily settlement files from payment gateways — the Cron Expression Generator pairs well for building the schedule side of that pipeline. And if you're building admin dashboards to visualise the parsed data, the Flexbox Playground helps lay out the UI without wrestling CSS by hand.

Tips from devs who parse JSON for a living

  • Always store money as integer paise, not float rupees. {"amount": 249900} for ₹2,499.00 avoids floating-point rounding. Razorpay, Stripe, and most serious payment APIs follow this. If you see "amount": 2499.00 in your payload, you're one currency conversion away from a ₹1 reconciliation bug.
  • Store phone numbers as strings, always. "9812345670" not 9812345670. Numbers can lose leading zeros and lose precision beyond 15 digits.
  • Timestamps in ISO 8601 with timezone. "2026-03-15T14:30:00+05:30", not "15/03/2026 2:30 PM". IST offset is +05:30, and forgetting it causes off-by-5.5-hours bugs in reports.
  • Reject unknown fields in strict APIs. If your bank integration layer silently accepts extra keys, you'll miss the day the upstream provider adds a "new_charge": 50 field you weren't expecting.
  • Log validated payload sizes. If your average webhook is 2KB and one suddenly arrives at 180KB, something upstream changed. The validator's size counter is a quick sanity check.

These habits don't come from JSON specs — they come from debugging production at 11 PM when a settlement job fails and ₹43L of merchant payouts are stuck.

One last practical note

For most Indian developers on patchy 4G, the big advantage of a browser-side validator is that it works offline after the page loads once. On a Rajdhani Express between Delhi and Mumbai, or in a Bangalore cafe where the WiFi drops every 10 minutes, you can still debug a payload. No round-trips to a server. No "request failed, please retry." The same logic applies to our finance tools — the EMI Calculator, SIP Calculator, GST Calculator, and Percentage Calculator all run client-side for the same reason. Fast, private, and functional on bad connections.

Paste your next broken payload and watch it get fixed in under a minute — open the JSON Validator →

Share this article

Related Articles

Popular Free Tools