I'm sending a JSON post to PHP that contains multiple items. My JSON looks like this:
[
{
"request": "submitTicket",
"id": "3",
"delivLoc": "1 COLORADO CITY",
"estimatedBarrels": "123.0",
"facilityID": "T666778",
"highDegreeF": "0.0",
"highOilFeet": "0"
},
{
"request": "submitTicket",
"id": "4",
"delivLoc": "1 COLORADO CITY",
"estimatedBarrels": "143.0",
"facilityID": "T666778",
"highDegreeF": "0.0",
"highOilFeet": "0"
},
{
"request": "submitTicket",
"id": "5",
"delivLoc": "1 COLORADO CITY",
"estimatedBarrels": "122.0",
"facilityID": "T666778",
"highDegreeF": "0.0",
"highOilFeet": "0"
}
]
I've been trying to use json_decode() in PHP but it comes back null which causes the foreach loop to fail. Why is the decode not working?
Actually this JSON gets back slashes put in it when arriving to PHP. I took those out before posting here and also tried running it with stripslashes().
Try this..