Cannot read property 'find' of undefined?

Why you open multiple if before end command ?

Use one if, and close it, and open anothe if and working like a charm.

     {
      "Command": "if_v2",
      "Target": "${market} == \"MY1\"",
      "Value": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": ""
    },

Your macro seems with more errors and command not closed.

Read this post you can use multiple condition in if to have a short and fast code, have not sense your long code