All Tools View Categories About Contact Privacy

IAM Policy JSON Syntax Validator

Two-pass validation — JSON syntax with line/column errors, then IAM structural requirements.

Runs entirely in your browser — your policy JSON never leaves this page.
0
statements
0
allow
0
deny

About IAM Policy JSON Syntax Validator

A hand-edited or copy-pasted IAM policy fails in two very different ways, and conflating them wastes time: either the text is not valid JSON at all — a trailing comma, a missing closing brace, a stray quote — or it is perfectly valid JSON that simply does not have the shape IAM requires, like a policy missing its Version field or a statement with no Effect. IAM Policy JSON Syntax Validator checks both, in the right order, and tells you specifically which kind of problem you have and where.

The first pass is pure JSON syntax. Pasted text runs through the same JSON parser your browser already has, and if that parser rejects it, the tool does not stop at a generic "invalid JSON" message — it reads the character position JavaScript's own parser reports internally, counts the newlines in your text up to that position, and converts it into a line and column number, the same way an editor would point you straight at the mistake. A dangling comma after the last item in a Statement array, a missing quote around a key, an extra closing brace — each produces a specific line and column rather than leaving you to scan the whole document by eye.

Only once the JSON itself parses cleanly does the second pass run: the same structural validator used across every policy tool in this category, checking that the document actually has the shape an IAM policy needs. Version must be present and be a recognized value (2012-10-17, or the legacy 2008-10-17). Statement must be present and must not be an empty array. Each individual statement must carry a recognized Effect of exactly Allow or Deny, must have an Action or a NotAction, and must have a Resource or NotResource — or, for a resource-based policy statement, a Principal in their place. Keeping this as a distinct second pass matters: a document can be syntactically flawless JSON and still be a broken IAM policy, and the tool tells you exactly which of the two problems you are looking at rather than lumping them together as one vague failure.

What this tool deliberately does not do is validate against the full grammar AWS itself enforces when you attach a policy. It has no catalog of valid IAM actions per service, does not check that a Resource value is a well-formed ARN for the service the action belongs to, does not check policy size against AWS's character-count quotas (the separate IAM Policy Size Checker in this category does that), and does not call any AWS API. It answers a narrower, earlier question: is this text valid JSON, and does it have the minimal shape IAM requires before you even attempt to attach it — the two checks that catch the overwhelming majority of hand-editing mistakes before they turn into a confusing "MalformedPolicyDocument" error from the AWS console or CLI.

Once a document passes both checks, a small stat summary shows the total statement count and how many are Allow versus Deny, so you can sanity-check the shape of what you just validated at a glance. The whole check — JSON parsing and structural validation alike — runs locally in your browser; nothing you paste is ever sent anywhere.

Features

  • Two-pass validation — JSON syntax first, then IAM policy structure.
  • Line and column reporting for JSON syntax errors, computed from the parser's own error position.
  • Structural checks — Version, non-empty Statement, and per-statement Effect/Action/Resource presence.
  • Distinguishes syntax errors from structure errors instead of one generic failure message.
  • Allow/Deny statement count shown once a document validates.
  • Handles multi-statement documents of any size.
  • Sample valid and sample broken policy to see both outcomes immediately.
  • One-click clear.
  • 100% client-side — nothing is uploaded.

How to Use

  1. Paste your policy JSON, or click a sample.
  2. Click Validate (or just stop typing — it checks live).
  3. If it is not valid JSON, jump to the reported line and column and fix the syntax.
  4. If it parses but fails structure, read the specific missing-field errors listed.
  5. Once valid, check the statement count and Allow/Deny split shown.
  6. Copy the result summary if you need it for a ticket.

Examples

Example 1 — trailing comma. {"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":"*","Resource":"*"},]} fails at the line/column of the stray comma before the closing bracket.

Example 2 — missing Version. {"Statement":[{"Effect":"Allow","Action":"*","Resource":"*"}]} parses as valid JSON but fails structure with "Missing required field \"Version\"".

Example 3 — fully valid. A standard read-only S3 policy with Version, one Allow statement, correct Action/Resource — passes both checks, with the stat summary showing 1 statement, 1 allow, 0 deny.

Example 4 — unclosed brace. Deleting the final } from an otherwise valid policy produces a specific "Unexpected end of JSON input" syntax error.

Example 5 — Effect typo. "Effect":"allow" (lowercase) parses as valid JSON but fails structure, since IAM requires exactly Allow or Deny.

Benefits

  • Pinpoints exactly where JSON syntax breaks — line and column, not just "invalid".
  • Separates syntax problems from structural ones instead of one vague error.
  • Catches the mistakes that produce AWS's "MalformedPolicyDocument" before you ever submit the policy.
  • Works on documents of any size, pasted as-is.
  • Instant, local feedback while hand-editing policy JSON.
  • Private — policy content never leaves your browser.

Frequently Asked Questions

What is the difference between a "syntax" error and a "structure" error here?
A syntax error means the text is not valid JSON at all — a missing brace, a trailing comma, an unquoted key — and <code>JSON.parse</code> itself rejects it before any policy-specific logic ever runs. A structure error means the JSON parsed fine but does not have the shape IAM requires: a missing <code>Version</code>, an empty <code>Statement</code> array, a statement without an <code>Effect</code>. This tool checks both, in that order, and tells you which kind of problem you have.
How does it find the exact line and column of a syntax error?
It reads the character position JavaScript's own JSON parser reports in its error message, then counts newlines in the text up to that position to convert it into a line and column number — the same position your editor would show if it jumped straight to the offending character.
What structural checks run once the JSON parses?
The same structural validator used across the tools in this category: <code>Version</code> must be present and be <code>2012-10-17</code> (or the legacy <code>2008-10-17</code>), <code>Statement</code> must be present and non-empty, and every statement must have a recognized <code>Effect</code> (<code>Allow</code> or <code>Deny</code>), an <code>Action</code> or <code>NotAction</code>, and a <code>Resource</code>/<code>NotResource</code> (or a <code>Principal</code> for a resource-based policy).
Does this validate against the full IAM policy grammar AWS enforces?
No. AWS's own policy validation covers far more — valid action and condition-key names for the specific service, ARN format inside <code>Resource</code>, policy size limits, and more. This tool checks that the JSON parses and that the document has the required top-level shape; it does not call AWS or check action/resource names against a live service catalog.
Can I paste an entire multi-statement policy?
Yes — the whole document, however many statements it has, is parsed and checked as one unit.
What if I paste something that is not JSON at all, like plain text?
You get a syntax error immediately, with a line and column pointing at wherever the parser gave up — usually very close to the start for non-JSON text.
Does it tell me how many statements are Allow vs Deny?
Yes, once the document is structurally valid, a small stat summary shows the total statement count and the Allow/Deny split.
Is my policy JSON uploaded anywhere?
No — both the JSON parse and the structural check run entirely in your browser.