“Read-Json-Data-Response-Us-Use-Php” Code-Antworten

Read-Json-Data-Response-Us-Use-Php

$json_data = '{
      "stat": "ok",
      "profile": {
        "providerName": "testing",
        "identifier": "http://testing.com/58263223",
        "displayName": "testing",
        "preferredUsername": "testing",
        "name": {
          "formatted": "testing"
        },
        "url": "http://testing.com/testing/",
        "photo": "https://securecdn.testing.com/uploads/users/5826/3223/avatar32.jpg?1373393837",
        "providerSpecifier": "testing"
      }
    }';

$json = json_decode($json_data);

echo $json->profile->displayName;
echo $json->profile->preferredUsername;
DreamCoder

Read-Json-Data-Response-Us-Use-Php

$json = '[
    {
        "displayName": "testing",
        "preferredUsername": "testing",
    }
]';

$jsonArray = json_decode($json);

foreach($jsonArray as $value){
    $displayName = $value->Display Name;
    $preferredUsername = $value->Preferred User;
}
DreamCoder

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen