Js url passes parameters of object and array types, which cannot be parsed

this code is the method I used to concatenate parsing objects into url strings

 encodeParamsStr: function(obj) {
    var params = [];
    Object.keys(obj).forEach(function(key) {
      var value = obj[key];
      // undefined
      if (typeof value === "undefined") {
        value = "";
      }
      // 
      params.push([key, encodeURIComponent(value)].join("="));
    });
    return params.join("&");
  },

the following is my call

   let baseUrl = "static/html/charting_library/static/tv-chart.e816a7a6edc9de3ed709.html";
      let obj = {
        localserver:1,
        widgetbar:{"datawindow":false,"details":false,"watchlist":false,"watchlist_settings":{"default_symbols":[]}},
        drawingsAccess:{"type":"black","tools":[{"name":"Regression Trend"}]},
        timeFrames:[
          {"text":"5Y","resolution":"W","description":"5","title":"5"},
          {"text":"1Y","resolution":"D","description":"1","title":"1"},
          {"text":"6M","resolution":"120","description":"6","title":"6"},
          {"text":"3M","resolution":"60","description":"3","title":"3"},
          {"text":"1M","resolution":"30","description":"1","title":"1"},
          {"text":"5D","resolution":"5","description":"5","title":"5"},
          {"text":"1D","resolution":"1","description":"1","title":"1"}
        ],
        locale:"zh",
        customCSS:"night.css",
        debug:false,
        timezone:"Asia/Shanghai",
      }
      this.chartUrl = `${baseUrl}-sharp${this.$utils.encodeParamsStr(obj)}`;
      $("-sharpchart_iframe").attr("src", this.chartUrl);

is this the accessed url, in which the object is not parsed or Object,? the correct effect I need should be compiled

as shown in figure 2.

  

your function only parses the case where the obj attribute is the original value, right? Not if the attribute values are objects and arrays. It only judges the case of undefined, and does not deal with objects and arrays

Menu