简体   繁体   中英

Unidentified data structure - convert to object

I'm accessing an API. I'm unable to identify one of the values returned. I wish to convert this string to a javascript object, but not sure what the data is or how to go about it without jumping through hoops.

Any idea of what this is and how to convert it to an object?

{product_options: 'a:2:{s:15:"info_buyRequest";a:8:{s:4:"uenc";s:132:"aHR0
cDovL3d3dy5tb2JpbGVtYXR0cmVzcy5jb20uYXUvbWF0dHJlc3Nlcy9tYXR0cmVzc2VzLWJ5LXNpemUv
cXVlZW4vcm9tZS1sYXRleC1xdWVlbi5odG1sP19fX1NJRD1V";s:7:"product";s:3:"355";s:15:"
related_product";s:0:"";s:7:"options";a:1:{i:252;s:3:"879";}s:3:"qty";s:1:"1";s:
10:"return_url";s:0:"";s:8:"postcode";s:0:"";s:6:"isAjax";s:1:"1";}s:7:"options"
;a:1:{i:0;a:7:{s:5:"label";s:18:"Mattress Protector";s:5:"value";s:23:"(No) Matt
ress Protector";s:11:"print_value";s:23:"(No) Mattress Protector";s:9:"option_id
";s:3:"252";s:11:"option_type";s:9:"drop_down";s:12:"option_value";s:3:"879";s:1
1:"custom_view";b:0;}}}'}

You cannot convert this to a native object. Best you can do is parse it yourself starting with:

Value.split(';')

To convert it to an array first

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM