func replaceKeyProperties(dat map[string]interface{}) map[string]interface{} {
	delete(dat, "id")
	if dat["name"] != nil {
		dat["name"] = "{{.name}}"
	}
	if dat["displayName"] != nil {
		dat["displayName"] = "{{.name}}"
	}
	if dat["dashboardId"] != nil {
		dat["dashboardId"] = "{{.name}}"
	}
	return dat
}
replaceKeyProperties replaces name or displayname for each config
package jsoncreator
import (
	"encoding/json"
	"fmt"
	"net/url"
	"path/filepath"
	"github.com/dynatrace-oss/dynatrace-monitoring-as-code/pkg/api"
	"github.com/dynatrace-oss/dynatrace-monitoring-as-code/pkg/rest"
	"github.com/dynatrace-oss/dynatrace-monitoring-as-code/pkg/util"
	"github.com/spf13/afero"
)
type JSONCreator interface {
	CreateJSONConfig(fs afero.Fs, client rest.DynatraceClient, api api.Api, value api.Value,
		path string) (name string, cleanName string, filter bool, err error)
}
type JsonCreatorImp struct{}
func NewJSONCreator() *JsonCreatorImp {
	result := JsonCreatorImp{}
	return &result
}
func (d *JsonCreatorImp) CreateJSONConfig(fs afero.Fs, client rest.DynatraceClient, api api.Api, value api.Value,
	path string) (name string, cleanName string, filter bool, err error) {
	data, filter, err := getDetailFromAPI(client, api, value.Id)
	if err != nil {
		util.Log.Error("error getting detail %s from API", api.GetId())
		return "", "", false, err
	}
	if filter {
		return "", "", true, nil
	}
	jsonfile, name, cleanName, err := processJSONFile(data, value.Id, value.Name, api)
	if err != nil {
		util.Log.Error("error processing jsonfile %s", api.GetId())
		return "", "", false, err
	}
	fullPath := filepath.Join(path, cleanName+".json")
	err = afero.WriteFile(fs, fullPath, jsonfile, 0664)
	if err != nil {
		util.Log.Error("error writing detail %s", api.GetId())
		return "", "", false, err
	}
	return name, cleanName, false, nil
}
func getDetailFromAPI(client rest.DynatraceClient, api api.Api, name string) (dat map[string]interface{}, filter bool, err error) {
	name = url.QueryEscape(name)
	resp, err := client.ReadById(api, name)
	if err != nil {
		util.Log.Error("error getting detail for API %s", api.GetId(), name)
		return nil, false, err
	}
	err = json.Unmarshal(resp, &dat)
	if err != nil {
		util.Log.Error("error transforming %s from json to object", name)
		return nil, false, err
	}
	filter = isDefaultEntity(api.GetId(), dat)
	if filter {
		util.Log.Debug("Non-user-created default Object has been filtered out", name)
		return nil, true, err
	}
	return dat, false, nil
}
func processJSONFile(dat map[string]interface{}, id string, name string, api api.Api) ([]byte, string, string, error) {
	name, err := getNameForConfig(name, dat, api)
	if err != nil {
		return nil, "", "", err
	}
	dat = replaceKeyProperties(dat)
	cleanName := util.SanitizeName(name)  
	jsonfile, err := json.MarshalIndent(dat, "", " ")
	if err != nil {
		util.Log.Error("error creating json file  %s", id)
		return nil, "", "", err
	}
	return jsonfile, name, cleanName, nil
}