Sei sicuro che $jsonContents ritorna un array ?