pass a second parameter "true" to json_decode to have it return an array rather than an object - will be nicer than having the object and then casting it.  So like json_decode($jsonstring, true)