updated to return an empty json array if the type parameter is not satisfied