Fetch text values from JSON and Display pop onclick text
Your code is very prone to errors, since you write all your html tags and content as a single string. Containing html and javascript in that way is extremely unsafe. 

I would suggest creating your elements with document.createElement() and then using the JSON to set all the attributes. In the function you could just pass the id, and then find the correct json data for that id.

Concept code

function buildPopup(id) {
  let layer = findJsonData(id)

  let popup = document.createElement("div")
  popup.classList.add("txtContainer")
  popup.id = layer.name
  popup.style.left = layer.x + "px"
  popup.style.top = layer.y + "px"
  popup.style.fontFamily = layer.font
  popup.innerHTML = layer.text

  // adding a close button
  let btn = document.createElement("button")
  popup.appendChild(btn)
  btn.addEventListener("click", ()=&gt;{
      closePopup(layer.name)
  })

  document.body.appendChild(popup)
}


Example for calling this function

 &lt;a onclick="openPopUp('edit_good_1')"&gt;Open popup&lt;/a&gt;


Example for getting the json by id

 // this function will find the right json data for this id  
 function findJsonData(id){
     return {        
      "font" : "Arian",
      "x" : 201,
      "y" : 461,
      "src" : "180ef82d1.otf",
      "width" : 679,
      "type" : "text",          
      "text" : "Good Food",          
      "name" : "edit_good_1"
    }
 }


I realise this is a bit conceptual but hopefully it will point you in the right direction!

JSFiddle