0

I want to get the URLS from the JSON below.

$jsonArray = {
     "uuid": "signed",
    "PreSigned": "{'url': ['www.g.com', 'www.o.com']"}

I tried this $jsonArray -> PreSigned[0]->url

And it didn't work

Ernest Appiah
  • 133
  • 2
  • 13
  • I'm not sure what language you're showing in your snippet. Seems pseudocode php with javascript, but you need to know that PreSigned is an object and url is an array. so try `$jsonArray -> PreSigned->url[0]` which would return 'www.g.com' if it works. Edit: seems like PreSigned would need one more parse pass on it as it is now json encoded string. (And it is not valid json) It is all kind confusing. – Mr_KoKa May 09 '17 at 01:39
  • Use `json_decode` converting the json string to php array, `json_decode($jsonArray, true)` – Kevin Yan May 09 '17 at 01:40
  • http://stackoverflow.com/q/4343596/6521116 – LF00 May 09 '17 at 01:42
  • That is not valid PHP. At all. You need to do something else with what you got, simple as that. – junkfoodjunkie May 09 '17 at 01:42

0 Answers0