private static int getNextComma(char[] cs, int pos) {
      int braces = 0;
      while (true) {
         switch (cs[pos]) {
            case '[':
               braces++;
               break;
            case ']':
               if (--braces < 0) {
                  return pos;
               }
               break;
            case ',':
               if (braces == 0) {
                  return pos;
               }
               break;
         }
         pos++;
      }
   }