how to solve this json error : iam new in json i dont know how to stringify the the data . below i write a code for alert the content but some error is shown how i solve that error

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

     $('.savebutton').on('click', function (){

            var myjson = {}
            
            var  mainobject =[]
            myjson.push(mainobject);
            mainobject.main = {}
            mainobject.main.tittle = "'hai'";
            mainobject.main.sub = [];
            var subobejct = {}
            mainobject.main.sub.push(subobejct);
            subobejct.tittle = "levler";
            subobejct.tasks = []
            var task = {};
            subobejct.tasks.push(task);

            alert(JSON.stringify(myjson));
            return myjson;
       });

<!-- end snippet -->

