code: def get_kb_mappings_json(kb_name="", key="", value="", match_type="s",
                           limit=None):
      
      mappings = get_kb_mappings(kb_name, key, value, match_type)
      ret = []
      if limit is None:
          limit = len(mappings)
      for m in mappings[:limit]:
          label = m['value'] or m['key']
          value = m['key'] or m['value']
          ret.append({'label': label, 'value': value})
      return json.dumps(ret)
docs: Get leftside/rightside mappings from kb kb_name formatted as json dict.
  
      If key given, give only those with left side (mapFrom) = key.
      If value given, give only those with right side (mapTo) = value.
  
      :param kb_name: the name of the kb
      :param key: include only lines matching this on left side in the results
      :param value: include only lines matching this on right side in the results
      :param match_type: s = substring match, e = exact match
      :param limit: maximum number of results to return (are ALL if set to None)
      :return: a list of mappings