Как использовать оператор if внутри JSON?

Как использовать оператор if внутри JSON Вот код: ...................................... .................................................

var config =
             [
                {
                    "name"      : "SiteTitle",
                    "bgcolor"   : "",
                    "color"     : "",
                    "position"  : "TL",
                    "text"      : "step1",
                    "time"      : 5000
                },
                {
                    "name"      : "Jawal",
                    "bgcolor"   : "",
                    "color"     : "",
                    "text"      : "step2",
                    "position"  : "BL",
                    "time"      : 5000
                },
                {
                    "name"      : "Password",
                    "bgcolor"   : "",
                    "color"     : "",
                    "text"      : "step3",
                    "position"  : "TL",
                    "time"      : 5000
                }
            ],

            //define if steps should change automatically
            autoplay    = false,
            //timeout for the step
            showtime,
            //current step of the tour
            step        = 0,
            //total number of steps
            total_steps = config.length;

Это требуемый результат примерно так:

    var config =
         [

    if(page==true)  {               
            {
                "name"      : "SiteTitle",
                "bgcolor"   : "",
                "color"     : "",
                "position"  : "TL",
                "text"      : "step1",
                "time"      : 5000
            },
            {
                "name"      : "Jawal",
                "bgcolor"   : "",
                "color"     : "",
                "text"      : "step2",
                "position"  : "BL",
                "time"      : 5000
            }
    } else {
            {
                "name"      : "Password",
                "bgcolor"   : "",
                "color"     : "",
                "text"      : "step3",
                "position"  : "TL",
                "time"      : 5000
            }
    }
        ],

            //define if steps should change automatically
            autoplay    = false,
            //timeout for the step
            showtime,
            //current step of the tour
            step        = 0,
            //total number of steps
            total_steps = config.length;

На самом деле этот путь неправильный и делает ошибку синтаксиса JavaScript.

Ответы на вопрос(4)

Ваш ответ на вопрос