Get object with string identifier

前端 未结 4 1663
轮回少年
轮回少年 2021-01-29 04:58

I need help with getting property of object with String in JS.

I have object

elements = {
    element : {
            date: {
                 day: \'Mo         


        
4条回答
  •  时光说笑
    2021-01-29 05:57

    Modern browsers support JSON.parse().

    var arr_from_json = JSON.parse( json_string );
    

    In browsers that don't, you can include the json2 library.

    alert(arr_from_json.elements);
    

提交回复
热议问题