mercredi 27 avril 2016

wordpress wpdb - get_results as json

A json string is stored in a custom table field. When I try to retrieve it, some slashes get added:

[{"parameters":"{\"mytext1\":\"la ciudad..\",\"mytext2\":\"la playa\",\"mytext3\":\"la escuela\"}"},{"parameters":"{\"tipoOperacion\":\"suma\",\"decimales\":\"s\\u00ed\",\"numeros\":\"d0-100\"}"},{"parameters":"{\"direction\":\"EsteOeste\"}"},{"parameters":"{\"direction\":\"EsteOeste\"}"}]

Using stripslashes_deep or stripslashes actually remove slashes, but also create an invalid json string.

How can I process this text in order to get a working json string?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire