Thanks to Matt's solution I was able to save a text_format element that's part of a custom field, but I also wanted to store the chosen format so I did this:
public function massageFormValues(array $values, array $form, FormStateInterface $form_state) {
foreach($values as $index => $value) {
$values[$index]['body'] = json_encode($value$value['body']);
}
return $values;
}
When re-populating the edit form, I can json_decode as applicable to get the value and text format out of the string.