How to define an array with a single `defaults` command?
-array takes individual array elements as individual arguments.

defaults -currentHost write -g com.apple.keyboard.modifiermapping.1452-628-0 -array \
  '{ HIDKeyboardModifierMappingDst = 2; HIDKeyboardModifierMappingSrc = 0; }' \
  '{ HIDKeyboardModifierMappingDst = 0; HIDKeyboardModifierMappingSrc = 2; }' \
  '{ HIDKeyboardModifierMappingDst = 0; HIDKeyboardModifierMappingSrc = 10; }'


The ‘\’ are used to keep the shell waiting for the next line, so they can be omitted if written on one line. You don't need to use delete first: unlike -array-add, -array replaces the entire array with the new contents.

If you don't want to do it this way, here's an alternative: you can pass the data structure as a string. This is closer to the examples in your question and works the same.

defaults -currentHost write -g com.apple.keyboard.modifiermapping.1452-628-0 '(
  { HIDKeyboardModifierMappingDst = 2; HIDKeyboardModifierMappingSrc = 0; },
  { HIDKeyboardModifierMappingDst = 0; HIDKeyboardModifierMappingSrc = 2; },
  { HIDKeyboardModifierMappingDst = 0; HIDKeyboardModifierMappingSrc = 10; } )'