I do it like
public static map: Map<string, boolean> = new Map<string, boolean>();
// then created aThe following method will convert a Map to a JSON string:
public static getJSONObj():any{
string {
const json =return JSON.stringify(Object.fromEntries(map));
}
Example:
const x = new returnMap();
x.set("SomeBool", json;true);
x.set("number1", 1);
x.set("anObj", { name: "joe", age: 22, isAlive: true });
const json = getJSONObj(x);
// Output:
// '{"SomeBool":true,"number1":1,"anObj":{"name":"joe","age":222,"isAlive":true}}'
// and use this method