Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

alternative to json_decode before PHP 5.2

Tags:

json

php

php-5.2

Is there a simple alternative to using json_decode function in php versions prior to 5.2? I am feeling lazy at this time of night and can't be bothered to update php yet. Cheers.

like image 885
kalpaitch Avatar asked May 05 '26 09:05

kalpaitch


2 Answers

You can find six alternatives at json.org

like image 98
nxt Avatar answered May 06 '26 21:05

nxt


The comments for json_decode() include a few possible solutions.

Here's one that decodes by itself (though you shouldn't use it since it uses eval()! Oops.), and here's one that uses a PEAR module.

like image 25
Matchu Avatar answered May 06 '26 21:05

Matchu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!