analysis array and optimize the format of doc