Patrick Patrick - 2 months ago 23
JSON Question

PHP json_decode multiple objects (orders)

I have the following string from all orders I have to import:

[
{"BestellungID":"1","KundeID":"1","Anrede":"Herr"},
{"BestellungID":"2","KundeID":"2","Anrede":"Herr"},
{"BestellungID":"3","KundeID":"3","Anrede":"Herr"}
]


How can I decode every order with all elements?
The output is from an array which is json-encoded.

Answer

You can use json_decode

$array = json_decode($json, true);
Comments