I want to deserialize data from php serialize array in node js
I found in many questions use JSON.stringify() to serialize and for deserialize use JSON.parse but unable to do the same and not find any solution for the same too
My serialize data:-
a:1:{i:0;a:4:{s:10:"first_name";s:7:"Vikas";s:11:"last_name";s:6:"Kohli";s:8:"end_date";s:10:"2017-06-12";s:16:"position";s:19:"Software Developer";}}
How to deserialize this array ?
I found to slove the same using
- http://locutus.io/php/var/unserialize/ but I didn't saw any implementation for the same.
- https://github.com/naholyr/js-php-unserialize --- ( Compatibility issues -This library has been tested server-side only. For example it uses [].reduce, so it may not work on some browsers. Do not hesitate to make pull requests to fix it for you favorite browsers :) that's why not used
Also when I used the second method, then it results like
{ '0':
{ first_name: 'Vikas',
last_name: '899.99',
end_date: '2017-06-12',
position: 'Software Developer'
}
}
Now how would I fetch the data from that if I used as there can be data like 0, 1 ,2 and so on
I hope I am able to understand my question.