I solved the issue thanks to this answer: Serialized settings in rest api.
I was able to store all the options as a json object:
/**
* Create plugin options schema as an object and prepare it for the rest api.
* WP >=5.3
*/
function my_register_settings() {
$general_options = [
'show_in_rest' => [
'schema' => [
'type' => 'object',
'properties' => [
'is_show_post' => [
'type' => 'string',
'default' => 'true',
],
'is_show_page' => [
'type' => 'string',
'default' => 'true',
],
'is_show_cpt' => [
'type' => 'string',
'default' => '',
],
'featured_post_id' => [
'type' => 'string',
'default' => '',
],
],
],
],
];
// register plugin options as an object
register_setting(
'awg_settings',
'awg_options',
$general_options
);
}
add_action( 'init', 'my_register_settings' );