CloudFormation YAML JSON Converter Tool - Bidirectional Converter with Short-form Intrinsic Functions
First Published:
Last Updated:
!Ref, !Sub, !GetAtt, !Join, !If, and more). Unlike a generic YAML converter, this tool preserves CFN semantics in both directions.All processing is performed entirely in your browser using client-side JavaScript. Your CloudFormation templates never leave your device, and no data is transmitted to any server.
- This tool is provided "AS IS" without any warranties of any kind.
- The author accepts no responsibility for data loss, conversion errors, or any issues arising from use.
- Comments, anchors, and aliases are not preserved during conversion.
- Complex or non-standard templates may not convert perfectly - always verify the result.
- Always keep backups of your original templates.
- By using this tool, you accept full responsibility for any outcomes.
This tool uses client-side JavaScript for all processing. No data is transmitted to servers, no files are uploaded online, all processing happens locally in your browser. Once loaded, this tool continues to work even without an internet connection. For more details, please refer to our Web Tools Disclaimer.
Drop a CloudFormation template here
or click to browse (.yaml, .yml, .json, .template — up to 5 MB)
Load a preset CloudFormation template to see how each intrinsic function is converted.
Features
- Bidirectional Conversion: Convert CloudFormation YAML to JSON and JSON to YAML with one click.
- Short-form Intrinsic Function Support: 16 short-form tags (
!Ref,!Sub,!GetAtt,!Join,!If, and more) are correctly translated to and fromFn::*/Refmappings. - Smart !GetAtt Handling: Scalar dot notation (
!GetAtt Resource.Attr) and sequence form (["Resource", "Attr"]) are converted both ways, so a round-trip preserves the intent. - Flexible Output: Choose JSON indent (2 / 4 / tab), YAML short-form vs. full-form, and optional key sort.
- Client-Side Processing: All processing happens locally in your browser - no data sent to any server.
- Three Input Methods: Paste, drag-and-drop a template file, or load a preset sample.
- Error Reporting: Parse errors include the line and column where the problem was detected.
- Offline-capable: Works without an internet connection once the page is loaded.
How to Use
- Choose an input method: paste your template, drop a file (
.yaml/.yml/.json/.template), or click a sample preset. - Leave Direction on Auto detect (JSON is detected by a leading
{or[; everything else is treated as YAML), or pick the direction explicitly. - Pick an output style: JSON indent, YAML short-form vs. full-form, and whether to sort object keys.
- Click Convert. The result appears in the Output panel.
- Use Swap Input / Output to round-trip the result back through the converter.
- Use Copy Output or Download Output to export the result.
Supported Intrinsic Functions
All 16 CloudFormation short-form intrinsic function tags plus !Condition are supported.
| Short-form tag | Expanded form | YAML node kind(s) |
|---|---|---|
!Ref | { "Ref": "..." } | scalar |
!Sub | { "Fn::Sub": ... } | scalar, sequence |
!GetAtt | { "Fn::GetAtt": ["LogicalId", "Attr"] } | scalar (dot) or sequence |
!Join | { "Fn::Join": [delim, list] } | sequence |
!Select | { "Fn::Select": [index, list] } | sequence |
!Split | { "Fn::Split": [delim, string] } | sequence |
!FindInMap | { "Fn::FindInMap": [Map, TopKey, SecondKey] } | sequence |
!If | { "Fn::If": [Cond, IfTrue, IfFalse] } | sequence |
!Equals | { "Fn::Equals": [a, b] } | sequence |
!And | { "Fn::And": [...] } | sequence |
!Or | { "Fn::Or": [...] } | sequence |
!Not | { "Fn::Not": [expr] } | sequence |
!Base64 | { "Fn::Base64": ... } | scalar, sequence, mapping |
!Cidr | { "Fn::Cidr": [block, count, bits] } | sequence |
!ImportValue | { "Fn::ImportValue": ... } | scalar, sequence, mapping |
!Transform | { "Fn::Transform": {Name, Parameters} } | mapping |
!Condition | { "Condition": "..." } | scalar (load only; see Notes) |
Important Notes
- Comments are not preserved. YAML comments are dropped when parsed (JSON has no comment syntax).
- Anchors and aliases are resolved inline. YAML
&anchor/*aliasreferences are expanded during conversion. !Conditionis only auto-generated on load. On JSON → YAML short-form conversion, a{ "Condition": "..." }object is left as a plain mapping, because it is ambiguous with the resource-levelConditionproperty. The intrinsic tag is recognized on YAML → JSON load.- !GetAtt round-trip. Scalar dot form like
!GetAtt LB.DNSNameexpands to["LB", "DNSName"]. On the return trip, two-string arrays are emitted as dot form for readability. - Short-form vs. full-form. Choose Full-form if you prefer
Fn::Sub: ...mappings in YAML output (useful when feeding the result into tools that only accept the long form). - Sort keys caveat. CloudFormation has a conventional top-level order (AWSTemplateFormatVersion, Description, Parameters, Mappings, Conditions, Resources, Outputs). Enable Sort keys only if you explicitly want alphabetical ordering.
- This tool does not validate CloudFormation semantics. Use a linter (cfn-lint) or
aws cloudformation validate-templatefor semantic checks. This tool only handles syntactic conversion. - For generic (non-CFN) YAML/JSON conversion, use the YAML JSON Converter Tool instead.
Third-Party Libraries:
- js-yaml (v4.1.0) - License: MIT (Vitaly Puzrin) - https://github.com/nodeca/js-yaml
References:
Tech Blog with curated related content
Web Tools Collection