How to Parse a JSON Object with JSON parse error

this is the main service imports and export class main service were we defined the property of the badgeColorsSet to a string

import { Injectable } from '@angular/core';
import { Observable, Subject, throwError } from 'rxjs';
import { map, mergeMap, repeatWhen } from 'rxjs/operators';
// import { environment } from '../../../environments/environment.prod';
import { HttpClient, HttpErrorResponse, HttpHeaders, } from '@angular/common/http';
import { GetPermissionsRequestPayload } from '../../dtos/get-permissions-request-payload';
import { ServiceResponse } from '../../dtos/Response';
import { Store } from '@ngrx/store';
import { AppState } from 'app/redux-store/reducers';
import { SetMenu, SetRoutes } from 'app/redux-store/actions/menu.actions';
import { Router } from '@angular/router';
// import { AddRecordComponent, DynamicProgramComponent, UpdateRecordComponent } from 'fuse-libs';
import { SetFormats } from 'app/redux-store/actions/auth.actions';
import { GetMenuResponsePayload } from 'app/dtos/response-payloads/get-menu-response-payload';
import { GlobalParametersService } from '../gloabal-parameters.service';
import { environment } from 'assets/environments/environment';
import { AppInitService } from '../app-init-service/app-init.service';
import { GetProgramPendingCountRequestPayload } from 'app/dtos/request-payloads/getProgramPendingCount-request-payload';
import { GetModulePendingCountRequestPayload } from 'app/dtos/request-payloads/getModulePendingCount-request-payload';

this is the main service imports and export class main service were we defined the property of the badgeColorsSet to a string
const httpOptions = {
headers: new HttpHeaders({
‘Content-Type’: ‘application/json’,
Authorization: ‘id_token’
})
};

@Injectable({
providedIn: ‘root’
}) //export class

    primaryColor;
    url ;
    myRoutes: any[]  = [];
    count: number;
    triggererModule = new Subject<any>();
    triggererProgram = new Subject<any>(); 
    badgesColorSet:string;
    

     constructor(private globalParamsService: GlobalParametersService,
        private http: HttpClient, private store: Store<AppState>,
        private router: Router , private appInitService: AppInitService) {
            
            this.url = this.appInitService.config.urlPath
            this.primaryColor = this.appInitService.config.primaryColor
            this.badgesColorSet = this.appInitService.config.badgesColorSet

**here is where we define the badgescolorset so it appears in the body**
    }

public getModulePendingCount(moduleCode: string): Observable<any> {
        const myCurrentPermission = JSON.parse(localStorage.getItem('currentPermission'));
        
        let className = "GetModulePendingCountRequestPayload"
        let programPendingCountPayload = new GetModulePendingCountRequestPayload(className, moduleCode )
        let obj =  {currentPermissions: {...myCurrentPermission  } , payload: programPendingCountPayload}
        return this.http.post<any>(this.url + '/getModulePendingCount',obj, httpOptions).pipe(map(resp => {

            return resp ;
        
            },
            error => {
                this.errorHandler(error);
            }
            
        ));
    }
     modifyData(data, currentPermission): any[] {

        return data.map(module => {
            let moduleBadge =    this.getModulePendingCount(module.code).pipe(map(data => {
                // console.log("module badge observable fired")
                return data.payload.count               
            }),repeatWhen(() => this.triggererModule))
            return {
                id: module.code,
                title: module.dsc,
                type: 'collapsable',
                icon: 'apps',
                classes:['module'],
                badge: {bg: this.getRandomColor() , fg: 'white' , title: moduleBadge},
                children: module.menus.map(menu => {
                    return {
                        id: menu.code,
                        title: menu.dsc,
                        type: 'collapsable',
                        // icon: 'dashboard',
                        classes: ['menu'],
                        children:
                            menu.programs.map(program => {
                                let myBadge = new Observable
                                // if(module.code == 'MX'){
                                
                             myBadge =   this.getProgramPendingCount(module.code , menu.code , program.code).pipe(map(data => {
                                    return data.payload.count
                                    
                                }),repeatWhen(() => this.triggererProgram)) **i already parsed the function but it's still doesn't show on my website**
                            // }
                                let url = [''];
                                let lang = localStorage.getItem['Language'];
                                const queryParams = {lang:lang, moduleCode: module.code, menuCode: menu.code, programCode: program.code, ...currentPermission, programLabel: program.dsc , programType: program.formType , routePath: program.routePath };
                                if (program.formType === 'StaticForm') {

                                    url = ['main/' + module.code.toLowerCase() + '/'
                                        + menu.code.toLowerCase() + '/' + program.code.toLowerCase()];
                                }

                                else {
                                    url = ['main/' + module.code.toLowerCase() + '/'
                                        + menu.code.toLowerCase() + '/' + program.code.toLowerCase()];
                                }
                                return {
                                    id: program.code,
                                    title: program.dsc,
                                    type: 'item',

                                    url: url,
                                    classes: ['program'],
                                    queryParams: queryParams,
                                    badge :{title: myBadge , bg: this.getRandomColor()  , fg: '#FFF'},
                                    completeId: {
                                        module: module.code,
                                        menu: menu.code,
                                        program: program.code
                                    }
                                };
                            })
                    };
                })
            };
        }); **I'm trying to send some data into a JSON object, and then into a cookie. But I'm getting this error when im trying to parse it: "SyntaxError: JSON Parse error: Unable to parse JSON string".**
    }```

getRandomColor(){ this is my function that needs to parsed im trying to get a material badge to change its color randomly whenever i refresh the page and this function is in main.service.ts
console.log(‘colors’)
// let colors = [‘#33FFFD’, ‘#FFD133′,’#FF7733′,’#3386FF’]; // to add my color codes
console.log(this.badgesColorSet)
let badgesColorSet = JSON.parse(this.badgesColorSet.get(‘getRandomColor’));

return this.badgesColorSet[Math.floor(Math.random() * this.badgesColorSet.length)];
 

}