Web Version Guide1 min

Anchor Preservation Feature

How to preserve YAML anchors

Anchor Preservation Feature

YAMLforge's key feature: anchor preservation.


🔗 What are YAML Anchors?

YAML anchors let you reuse the same data in multiple places:

# Anchor definition
defaults: &defaults
  timeout: 30
  retries: 3

# Reuse with alias
production:
  <<: *defaults
  host: prod.example.com

staging:
  <<: *defaults
  host: staging.example.com

❌ Problem with Other Tools

Other converters expand and lose anchors:

{
  "defaults": {"timeout": 30, "retries": 3},
  "production": {"timeout": 30, "retries": 3, "host": "prod.example.com"},
  "staging": {"timeout": 30, "retries": 3, "host": "staging.example.com"}
}

Converting back to YAML won't restore anchors.


✅ YAMLforge Solution

YAMLforge preserves anchor info as metadata.

How to Use

  1. Turn ON "Preserve Anchors" option
  2. Run conversion
  3. Anchors restored when converting JSON → YAML

📊 Support Status

Anchor TypeSupported
Basic &name
Alias *name
Merge key <<
Nested anchors
Tags
#anchor#yaml#feature#preservation