C
C
CrewCut2016-02-04 18:09:26
JavaScript
CrewCut, 2016-02-04 18:09:26

How to convert string to multidimensional array in jQuery?

There is this line:

[
{'variation_id':32946,'variation_is_visible':true,'variation_is_active':true,'is_purchasable':true,'display_price':6900,'display_regular_price':6900,'attributes':{'attribute_razmer':'64','attribute_tsvet':'зеленый'},'image_src':'','image_link':'','image_title':'','image_alt':'','image_srcset':'','image_sizes':'','price_html':'','availability_html':'<p class=\'stock in-stock\'>В наличии<\/p>','sku':'55903','weight':' kg','dimensions':'','min_qty':1,'max_qty':2,'backorders_allowed':false,'is_in_stock':true,'is_downloadable':false,'is_virtual':false,'is_sold_individually':'no','variation_description':''},
{'variation_id':32947,'variation_is_visible':true,'variation_is_active':true,'is_purchasable':true,'display_price':6900,'display_regular_price':6900,'attributes':{'attribute_razmer':'56','attribute_tsvet':'зеленый'},'image_src':'','image_link':'','image_title':'','image_alt':'','image_srcset':'','image_sizes':'','price_html':'','availability_html':'<p class=\'stock in-stock\'>В наличии<\/p>','sku':'55903','weight':' kg','dimensions':'','min_qty':1,'max_qty':1,'backorders_allowed':false,'is_in_stock':true,'is_downloadable':false,'is_virtual':false,'is_sold_individually':'no','variation_description':''}
]


In fact, this is an array transformed into a string. Need to overtake in the opposite direction, what is the best way to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
timfcsm, 2016-02-04
@CrewCut

this is your JSON string practically .. just change all the quotes to double and remove line breaks
later like this:
JSON.parse(string);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question