Sort yaml structures alphabetically by root key names

sometimes we want to sort structures alphabetically in yaml files

Input

c:
  required: false

h:
  optional: true
  choice:
    - true
    - false

f:
  required: true

e:
  optional: true
  choice:
    - b
    - a

g:
  optional: false

j:
  required: true

a:
  required: true

i:
  required: false

d:
  required: false

b:
  optional: true
  choice:
    - 1
    - 2

Output

a:
  required: true

b:
  optional: true
  choice:
    - 1
    - 2

c:
  required: false

d:
  required: false

e:
  optional: true
  choice:
    - b
    - a

f:
  required: true

g:
  optional: false

h:
  optional: true
  choice:
    - true
    - false

i:
  required: false

j:
  required: true