Php 如何将条带计划json响应放入数组中

Php 如何将条带计划json响应放入数组中,php,json,stripe-payments,strip,Php,Json,Stripe Payments,Strip,问题是我没有从这个json获取数组 Stripe\Plan JSON: { "id": "plan_DbP7kQM1OUScdl", "object": "plan", "active": true, "aggregate_usage": null, "amount": 5000, "billing_scheme": "per_unit", "created": 1536912374

问题是我没有从这个json获取数组

 Stripe\Plan JSON: {
        "id": "plan_DbP7kQM1OUScdl",
        "object": "plan",
        "active": true,
        "aggregate_usage": null,
        "amount": 5000,
        "billing_scheme": "per_unit",
        "created": 1536912374,
        "currency": "usd",
        "interval": "month",
        "interval_count": 1,
        "livemode": false,
        "metadata": [],
        "nickname": null,
        "product": "prod_DbP70yDV8qUGND",
        "tiers": null,
        "tiers_mode": null,
        "transform_usage": null,
        "trial_period_days": null,
        "usage_type": "licensed"
    }

您可以通过json_解码来实现

$array_val = json_decode($json_string, true);

它将返回您的数组。

从中获取数组时,您的可能副本是什么?是的,这是您通常使用Json所做的。您的“问题”有点不清楚。@Andreas我使用了json_decode(),但不起作用。我已经测试过了,这是有效的$json_string='{“id”:“plan_dbp7kqm1ousdl”,“object”:“plan”,“active”:true,“aggregate_usage”:null,“amount”:5000,“billing_scheme”:“peru unit”,“created”:1536912374,“currency”:“usd”,“interval”:“month”,“interval_count”:1,“livemode”:false,“metadata”:[],“昵称”:null,“产品”:“prod_DbP70yDV8qUGND”,“tiers”:null,“tiers”,“tiers”:null,“转换使用”:null,“试用期天数”:null,“使用类型”:“许可”}$array_val=json_decode($json_string,true);打印(数组值);您的Json字符串位于“Stripe\Plan Json:”文本之后,不包括此文本。