Why convert YAML to JSON?
Many APIs and tools — kubectl --output json, AWS CloudFormation, JSON Schema validators — want JSON, and seeing the JSON is the fastest way to catch YAML surprises: a version 1.10 that became the number 1.1, an indentation slip that moved a key to the wrong parent, or on: in a workflow file.
Comments are dropped (JSON has none) and anchors/aliases are expanded into full copies.