-1

すべてのJSON_DECODEの投稿を読みましたが、このマッシャーコードを解析する方法がわかりません。

ソースは次のとおりです。

[{
    "packageInfo": [
        {
            "ndc3Segment": "58406-435-04",
            "packageDescription": "4 SYRINGE in 1 CARTON (58406-435-04)  > 1 mL in 1 SYRINGE (58406-435-01) "
        }
    ],
    "unit": "mg/mL",
    "strength": "50",
    "nda": "BLA103795",
    "proprietaryName": "ENBREL",
    "nonProprietaryName": "etanercept",
    "dosageFormname": "SOLUTION",
    "routeName": "SUBCUTANEOUS",
    "startMarketing_date": "Thu Oct 06 00:00:00 EDT 2005",
    "endMarketing_date": "",
    "labelerName": "Immunex Corporation",
    "substanceName": "ETANERCEPT",
    "ndc2Segment": "58406-435"
},
{
    "packageInfo": [
        {
            "ndc3Segment": "58406-445-04",
            "packageDescription": "4 SYRINGE in 1 CARTON (58406-445-04)  > 1 mL in 1 SYRINGE (58406-445-01) "
        }
    ],
    "unit": "mg/mL",
    "strength": "50",
    "nda": "BLA103795",
    "proprietaryName": "ENBREL",
    "nonProprietaryName": "etanercept",
    "dosageFormname": "SOLUTION",
    "routeName": "SUBCUTANEOUS",
    "startMarketing_date": "Thu Nov 10 00:00:00 EST 2005",
    "endMarketing_date": "",
    "labelerName": "Immunex Corporation",
    "substanceName": "ETANERCEPT",
    "ndc2Segment": "58406-445"
},
{
    "packageInfo": [
        {
            "ndc3Segment": "58406-425-34",
            "packageDescription": "4 KIT in 1 CARTON (58406-425-34)  > 1 KIT in 1 KIT (58406-425-41)  *  1 mL in 1 VIAL *  1 mL in 1 SYRINGE (58406-910-01) "
        }
    ],
    "unit": "",
    "strength": "",
    "nda": "BLA103795",
    "proprietaryName": "ENBREL",
    "nonProprietaryName": "etanercept",
    "dosageFormname": "KIT",
    "routeName": "",
    "startMarketing_date": "Thu Jan 02 00:00:00 EST 2003",
    "endMarketing_date": "",
    "labelerName": "Immunex Corporation",
    "substanceName": "",
    "ndc2Segment": "58406-425"
},
{
    "packageInfo": [
        {
            "ndc3Segment": "54868-4782-0",
            "packageDescription": "4 KIT in 1 CARTON (54868-4782-0)  > 1 KIT in 1 KIT *  1 mL in 1 VIAL *  1 mL in 1 SYRINGE"
        }
    ],
    "unit": "",
    "strength": "",
    "nda": "BLA103795",
    "proprietaryName": "ENBREL",
    "nonProprietaryName": "etanercept",
    "dosageFormname": "KIT",
    "routeName": "",
    "startMarketing_date": "Wed Apr 30 00:00:00 EDT 2003",
    "endMarketing_date": "",
    "labelerName": "Physicians Total Care, Inc.",
    "substanceName": "",
    "ndc2Segment": "54868-4782"
},
{
    "packageInfo": [
        {
            "ndc3Segment": "54868-5444-0",
            "packageDescription": "4 SYRINGE in 1 CARTON (54868-5444-0)  > 1 mL in 1 SYRINGE"
        }
    ],
    "unit": "mg/mL",
    "strength": "50",
    "nda": "BLA103795",
    "proprietaryName": "ENBREL",
    "nonProprietaryName": "etanercept",
    "dosageFormname": "SOLUTION",
    "routeName": "SUBCUTANEOUS",
    "startMarketing_date": "Thu Oct 06 00:00:00 EDT 2005",
    "endMarketing_date": "",
    "labelerName": "Physicians Total Care, Inc.",
    "substanceName": "ETANERCEPT",
    "ndc2Segment": "54868-5444"
},
{
    "packageInfo": [
        {
            "ndc3Segment": "58406-455-04",
            "packageDescription": "4 SYRINGE in 1 CARTON (58406-455-04)  > .5 mL in 1 SYRINGE (58406-455-01) "
        }
    ],
    "unit": "mg/.5mL",
    "strength": "25",
    "nda": "BLA103795",
    "proprietaryName": "ENBREL",
    "nonProprietaryName": "etanercept",
    "dosageFormname": "SOLUTION",
    "routeName": "SUBCUTANEOUS",
    "startMarketing_date": "Thu Nov 10 00:00:00 EST 2005",
    "endMarketing_date": "",
    "labelerName": "Immunex Corporation",
    "substanceName": "ETANERCEPT",
    "ndc2Segment": "58406-455"
}]

私が見るすべてのネストJSONにはトップレベルのユニバーサルデータ名があり、これはレコードトップとして「packageInfo」を持っているように見えますが、それらすべてを保持するには「packageInfo」よりも優れたオブジェクトが必要だと思いました。私は間違っているに違いない。

すべての「proprietaryName」を印刷するにはどうすればよいですか?

4

1 に答える 1

1

試す

$json = json_decode($jsonstring);
foreach ($json as $package){
    echo $package->proprietaryName;
}
于 2012-08-07T22:13:40.430 に答える