Site icon Hip-Hop Website Design and Development

Save default options as an array of options and display in REST API

I am trying to save array of options and display them in the rest api.
I know I can store the options one by one with register_setting, but I think saving all the options in an array is better than saving each option individually, since it will be just one request instead of four different requests. However, the response I get is awg_settings: null

$general_options = [
    'is_show_post'     => true,
    'is_show_page'    => true,
    'is_show_cpt'      => '',
    'featured_post_id' => '',
];

// register plugin options
add_option( 'awg_settings', $general_options );

register_setting(
    'awg_option_fields',
    'awg_settings',
    [
        'show_in_rest' => true,
        'type'         => 'array',
    ]
);


    componentDidMount() {
        // fetch all plugin options
        api.loadPromise.then(() => {
            this.settings = new api.models.Settings();
            const { isAPILoaded } = this.state;

            if (!isAPILoaded) {
                this.settings.fetch().then((response) => {
                    console.log(response);
                });
            }
        });
}