-3

Problem is I am not getting array from this 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"
    }
Nisarg
  • 1,631
  • 6
  • 19
  • 31

1 Answers1

1

You can do it through json_decode

$array_val = json_decode($json_string, true);

It will return you array.

ABHI
  • 122
  • 1
  • 9
  • I have tested and this is working. $json_string= '{ "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" }'; $array_val = json_decode($json_string, true); print_r($array_val); – ABHI Sep 14 '18 at 11:23
  • Your Json string is after "Stripe\Plan JSON:" text not including this text. – ABHI Sep 14 '18 at 11:26