如何返回一组分组项?

问题描述

我有一个简单的[array([[[-1.36013642e-01,1.59766637e-02,4.49674837e-02,2.87157446e-02,-9.56720412e-02,-8.88903514e-02,-5.33084199e-02,-2.13210974e-02,1.41174316e-01,-4.11187410e-02,1.70307457e-01,-2.14784797e-02,-1.35124326e-01,-1.13939375e-01,-3.31919976e-02,6.11963794e-02,-1.17217958e-01,-1.50817335e-01,-4.65203971e-02,-1.00571744e-01,7.85203278e-02,2.94833463e-02,1.02086905e-02,1.93061940e-02,-2.32153490e-01,-3.00551683e-01,-1.17443979e-01,-1.46142572e-01,1.07608363e-01,-9.40902233e-02,-3.90545353e-02,4.42864373e-02,-1.29430681e-01,-7.02960119e-02,8.21319446e-02,1.80883124e-01,-2.02056542e-02,-2.47046854e-02,1.82081938e-01,3.43354326e-03,-1.19226977e-01,-5.64751402e-03,5.98295629e-02,3.01894635e-01,1.70621589e-01,1.36449412e-01,4.88062464e-02,-4.68050130e-02,1.07072420e-01,-2.24809378e-01,1.33529887e-01,1.69836447e-01,1.21353425e-01,3.47930416e-02,2.27185443e-01,-2.41639778e-01,3.87575626e-02,1.36878729e-01,-1.31427586e-01,1.35682166e-01,-8.80223699e-04,1.59485396e-02,2.62592174e-02,-3.75868753e-02,1.91311508e-01,6.34296760e-02,-6.77121654e-02,-9.76699442e-02,1.88637391e-01,-1.95635721e-01,2.61483667e-03,1.27198607e-01,-7.48684406e-02,-1.59019291e-01,-2.47020170e-01,-3.68376747e-02,4.33871210e-01,1.57070860e-01,-1.62113741e-01,3.82730290e-02,-3.92096601e-02,-4.57221121e-02,9.67647210e-02,-6.17119949e-05,-1.43869311e-01,-6.41668867e-03,-1.91071168e-01,-2.21797563e-02,2.02202812e-01,3.91443223e-02,4.61347327e-02,1.54131114e-01,7.47928210e-03,2.09267866e-02,3.87379229e-02,-5.46494387e-02,-1.59527451e-01,7.56314816e-03,-2.13688631e-02,-5.44707663e-02,6.98875338e-02,-1.67583689e-01,-1.69844925e-03,9.92566273e-02,-1.98496655e-01,6.26156628e-02,-2.95266993e-02,5.99580631e-03,-6.91434443e-02,3.17127258e-02,-1.32520899e-01,2.55816411e-02,1.90661669e-01,-2.88114160e-01,1.65751979e-01,1.89788476e-01,-3.19299102e-02,1.52912185e-01,8.25165361e-02,6.92607239e-02,-2.91225202e-02,-3.67325470e-02,-1.58863515e-01,-4.12161574e-02,-9.37818438e-02,-1.08723141e-01,1.27439285e-02,7.31237382e-02]],[[-1.37894586e-01,5.84010258e-02,9.80348736e-02,-9.55949910e-03,-6.22733906e-02,-5.63683398e-02,-2.26371922e-02,-8.96835402e-02,1.46475613e-01,-4.40802239e-02,1.53038278e-01,-3.29063646e-03,-1.69211119e-01,-1.14617534e-01,5.59688732e-03,5.93355000e-02,-1.27704740e-01,-1.71358287e-01,-4.84642014e-02,-8.19769055e-02,2.84060407e-02,6.13150261e-02,-7.79468417e-02,-8.77461210e-03,-2.00844258e-01,-2.88251281e-01,-7.33745247e-02,-1.42669410e-01,1.07440352e-01,-1.39590308e-01,-3.51556130e-02,-4.18033963e-03,-1.82463229e-01,-4.28252965e-02,5.28394952e-02,1.75120696e-01,-9.33501031e-03,-3.33592743e-02,1.65851176e-01,1.39791211e-02,-1.52489260e-01,-6.68389164e-03,5.71185611e-02,2.38399506e-01,1.53594971e-01,7.59008080e-02,1.48483068e-02,-5.43878600e-02,1.36847854e-01,-1.76150039e-01,1.25447407e-01,1.70887619e-01,1.22895576e-01,5.84644414e-02,1.99920326e-01,-2.79710770e-01,1.56115033e-02,5.12041822e-02,-1.93132162e-01,1.51428387e-01,5.97179160e-02,-1.93341300e-02,-4.03094850e-03,1.73912272e-02,1.02863029e-01,-4.60668234e-03,-6.12722374e-02,-1.03243664e-01,1.96056634e-01,-1.93443596e-01,2.90273000e-02,9.11512822e-02,-3.45249921e-02,-1.79792568e-01,-2.18977749e-01,2.92301551e-02,3.94104689e-01,1.66036054e-01,-2.10731253e-01,4.83864099e-02,-4.31987755e-02,-9.82125998e-02,1.06999256e-01,1.90159921e-02,-5.58431894e-02,3.04446071e-02,-1.47668719e-01,8.35768692e-03,1.71920583e-01,7.69633651e-02,8.75835866e-02,1.86722219e-01,-2.75155809e-02,-1.05050392e-02,2.00979151e-02,-7.50234211e-03,-1.67125508e-01,2.20861211e-02,-4.32664342e-03,-5.50425760e-02,8.63447115e-02,-1.67248473e-01,1.38378460e-02,1.11343339e-01,-1.99985191e-01,1.35348290e-01,1.56460218e-02,2.73892656e-04,-6.41771033e-02,2.57192627e-02,-9.93981138e-02,8.97653773e-03,1.91183090e-01,-2.82200336e-01,2.23059848e-01,1.75120562e-01,-7.82503486e-02,1.47400096e-01,4.67997603e-02,7.76805580e-02,1.79661531e-02,-5.38391508e-02,-1.54771596e-01,-9.99689624e-02,-1.09263457e-01,-9.25640911e-02,1.83300804e-02,8.41395408e-02]],[[-1.50231764e-01,5.30236512e-02,5.80971278e-02,-6.91052619e-03,-6.63885847e-02,-8.69466662e-02,-1.51826143e-02,-5.16197905e-02,2.19310135e-01,-8.07677209e-02,1.71911135e-01,-3.65424380e-02,-1.77088380e-01,-9.78112444e-02,-1.38332583e-02,8.34669024e-02,-1.31156802e-01,-1.49645716e-01,-3.05147469e-02,-1.17407627e-01,1.71565767e-02,9.20448918e-03,-6.46030009e-02,-2.28046551e-02,-1.94293335e-01,-2.80386955e-01,-7.64302760e-02,-8.90514404e-02,1.17872708e-01,-9.60179269e-02,-3.07646766e-02,3.37364674e-02,-1.90276399e-01,-1.05832189e-01,6.49234205e-02,2.19782099e-01,-1.96797457e-02,1.40418569e-02,1.81732520e-01,-3.28570083e-02,-7.66380355e-02,6.89617405e-03,4.78702188e-02,2.45228872e-01,1.41428009e-01,1.00809440e-01,3.73133272e-03,-1.03467189e-01,8.70409757e-02,-2.12297142e-01,9.47272182e-02,1.90620258e-01,1.18681826e-01,3.31691504e-02,1.67793304e-01,-2.18925700e-01,-9.66489222e-03,1.24859490e-01,-1.71614006e-01,1.37775704e-01,8.33617598e-02,1.09298751e-02,-4.55547757e-02,-2.22153030e-02,1.64980054e-01,1.37728015e-02,-9.32593867e-02,-7.81709999e-02,2.22985357e-01,-1.69061244e-01,4.10387591e-02,4.30300683e-02,-1.11437151e-02,-1.98694319e-01,-2.07214892e-01,5.36098704e-02,3.90068620e-01,1.62774995e-01,-1.60267770e-01,7.80781955e-02,-5.54403551e-02,-9.31668729e-02,7.10664839e-02,-1.76445842e-02,-9.73844975e-02,-3.38197052e-02,-1.21390782e-01,4.05607447e-02,1.57834575e-01,6.25553131e-02,1.10172994e-01,1.51440471e-01,-1.40509475e-02,3.16431560e-02,-2.47017704e-02,-3.98907140e-02,-1.65499881e-01,3.11357491e-02,-5.87871447e-02,-4.44657058e-02,1.02798469e-01,-1.55324146e-01,4.02739719e-02,1.22631051e-01,-1.83685839e-01,1.04981773e-01,-6.72103511e-03,-2.01395378e-02,-1.53558785e-02,5.07285669e-02,-9.66893956e-02,-1.21531086e-02,2.01398820e-01,-2.65820712e-01,2.13555843e-01,1.77817732e-01,-6.56121820e-02,1.58264607e-01,8.97071287e-02,9.25853327e-02,6.48394227e-02,-1.72733609e-02,-1.74576581e-01,-6.79302812e-02,-1.20070800e-01,-1.09205380e-01,2.45773457e-02,9.11332145e-02]],[[-1.62274405e-01,3.15038860e-02,6.44017309e-02,3.45326737e-02,-1.05685055e-01,-1.77183170e-02,-8.56796950e-02,-7.91971534e-02,1.71855256e-01,-1.71298254e-02,1.86888188e-01,3.59892212e-02,-1.92580983e-01,-6.18249550e-02,1.21358195e-02,6.60665333e-02,-1.40805155e-01,-8.28307271e-02,-5.42851612e-02,-1.11442827e-01,-6.72461838e-03,1.96444243e-02,2.98103131e-02,6.19128272e-02,-1.93395317e-01,-2.87468702e-01,-8.87314901e-02,-1.30469680e-01,6.98416680e-02,-1.32677779e-01,5.21699619e-03,2.61115953e-02,-1.66991830e-01,-5.70339113e-02,6.47078753e-02,1.88027576e-01,-9.21493247e-02,-1.49603449e-02,2.01233804e-01,-8.49104673e-02,-1.06238969e-01,-3.60001624e-02,-2.23363750e-03,2.17491835e-01,1.87389106e-01,1.04524858e-01,5.11063896e-02,-6.64142743e-02,1.51605263e-01,-2.12667212e-01,1.45079419e-01,1.72637925e-01,6.61674738e-02,3.34243253e-02,1.31693542e-01,-2.69493669e-01,-4.82268780e-02,2.30443150e-01,-8.99494663e-02,1.42259493e-01,3.80099751e-03,-7.53545314e-02,-7.12354667e-03,-2.95820814e-02,1.53193980e-01,5.97309470e-02,-1.01371743e-01,-9.97453034e-02,1.79987788e-01,-1.37784496e-01,4.48415950e-02,1.53983220e-01,-1.05956972e-01,-2.62854129e-01,-2.18802154e-01,4.18419279e-02,4.67299223e-01,1.23464331e-01,-1.62302554e-01,3.13426740e-03,-6.86671678e-03,-6.07644059e-02,4.79412451e-02,8.40777308e-02,-6.54070973e-02,-4.18782346e-02,-1.13178916e-01,5.20941988e-02,1.85022369e-01,5.36964908e-02,3.61735113e-02,1.85169518e-01,-1.91164780e-02,6.12748265e-02,5.99459792e-03,-2.01658588e-02,-1.01727784e-01,4.70405584e-03,-5.25830835e-02,-4.94561940e-02,4.53589484e-02,-7.16509372e-02,2.04778500e-02,5.09201735e-02,-1.25631809e-01,1.64057955e-01,9.62968543e-03,4.30290811e-02,-5.18420413e-02,-2.88595539e-02,-9.53822657e-02,3.55528444e-02,2.59569615e-01,-2.95394242e-01,2.28176743e-01,1.54641658e-01,-7.78511958e-03,2.09660888e-01,2.91666016e-02,9.74472538e-02,3.11672874e-02,-3.97840291e-02,-1.92549929e-01,5.36589068e-04,-2.17817314e-02,-1.05434239e-01,5.98730482e-02,4.11710367e-02]]]),array([[[-1.68740377e-02,1.52078941e-01,8.62133503e-02,3.47440667e-03,-7.50775635e-02,8.29034671e-02,-5.12160733e-02,-9.60651636e-02,5.18606864e-02,4.61538620e-02,2.11039424e-01,-7.04053193e-02,-2.30026633e-01,-2.06287913e-02,4.42361459e-02,1.13250390e-01,-1.38955295e-01,-7.81948566e-02,-1.18520640e-01,3.08102742e-03,-5.88674992e-02,3.52515951e-02,1.02329694e-01,-3.15367128e-03,-1.09225258e-01,-2.74011433e-01,-7.80899003e-02,-9.12662745e-02,1.24638416e-01,-8.57445747e-02,-3.88496295e-02,-1.19581092e-02,-1.75278068e-01,7.70506728e-03,7.80697837e-02,9.88397971e-02,-7.57867396e-02,-8.06069449e-02,2.28473604e-01,-2.36921087e-02,-1.76744461e-01,3.78885008e-02,8.70054811e-02,1.42934516e-01,2.38303959e-01,6.11009710e-02,4.36121263e-02,-3.50601189e-02,6.64255023e-02,-2.49209940e-01,1.57682329e-01,1.21789858e-01,1.16867483e-01,8.45996961e-02,5.76233957e-03,-1.76971704e-01,-4.91473451e-02,1.56083614e-01,-1.41750157e-01,7.08352476e-02,9.80508104e-02,-8.59858245e-02,-8.23098868e-02,-1.59299485e-02,1.51134863e-01,1.43824801e-01,-1.24966606e-01,-1.75318450e-01,1.13390550e-01,-1.68713510e-01,-3.53813954e-02,1.21039249e-01,-8.95563290e-02,-1.01484008e-01,-2.75068283e-01,5.46966009e-02,4.39682692e-01,3.67938466e-02,-1.56368658e-01,-1.16297044e-02,-1.52784062e-03,-2.47500669e-02,-1.95040870e-02,1.20051503e-01,-6.90754429e-02,-8.28582197e-02,-4.97369617e-02,2.63527036e-05,1.96313396e-01,-6.30125403e-02,4.69858525e-03,1.56594262e-01,-1.63011625e-02,5.98538369e-02,-2.65194569e-04,6.69567063e-02,2.51362212e-02,-5.55414632e-02,-2.93561518e-02,2.84286365e-02,-4.83711883e-02,-9.81986448e-02,-3.45682539e-02,7.68979266e-02,-1.98029101e-01,1.53635189e-01,7.00153364e-03,-3.65675725e-02,7.30676875e-02,-1.04091987e-02,-5.18539827e-03,-2.50395797e-02,2.01758057e-01,-3.52356672e-01,1.77500680e-01,1.84066370e-01,-4.49734628e-02,8.69778767e-02,3.74429524e-02,1.81517109e-01,7.69926533e-02,5.22192307e-02,-1.70259267e-01,-1.13618262e-01,-1.40291126e-02,-4.68849167e-02,-3.22203897e-02,5.76205775e-02]],[[-2.49804370e-02,1.70671448e-01,3.95690724e-02,-3.51276388e-03,-1.98742189e-02,7.46497139e-02,-2.03474741e-02,-1.11103363e-01,1.02668263e-01,2.93022245e-02,2.07146153e-01,3.29615586e-02,-2.63025105e-01,-2.46658288e-02,3.71336676e-02,8.23173597e-02,-1.64193496e-01,-9.91019532e-02,-1.28058136e-01,-2.77458709e-02,-3.55885737e-02,8.64468515e-02,6.67003468e-02,-4.39326577e-02,-1.09597728e-01,-2.84543842e-01,-7.25509301e-02,-8.68509933e-02,1.06886305e-01,-1.30941182e-01,-9.13744885e-03,4.62066382e-04,-1.28790632e-01,2.69941334e-02,8.28079656e-02,5.13078235e-02,-5.22269905e-02,-4.96672578e-02,2.61806935e-01,6.24357723e-02,-2.08110198e-01,5.77822179e-02,8.79181474e-02,2.49593109e-01,2.41651326e-01,-8.27671867e-03,-1.22608151e-02,-7.38239959e-02,8.41363668e-02,-2.08070427e-01,1.60519928e-01,1.58879861e-01,1.78740799e-01,1.20273851e-01,-4.65768203e-03,-2.10287139e-01,-4.37513739e-02,1.08855076e-01,-1.95248336e-01,5.24971373e-02,1.16677418e-01,-1.18925139e-01,-8.58063847e-02,1.45739652e-02,1.05634734e-01,1.13258652e-01,-1.43801495e-01,-1.55666292e-01,6.84999675e-02,-1.38900787e-01,-2.64124889e-02,9.55415145e-02,-1.27598137e-01,-1.43201396e-01,-2.41060451e-01,6.54740036e-02,3.65032971e-01,4.02122661e-02,-1.57019958e-01,-4.69299685e-03,-5.40541038e-02,-3.91884111e-02,-9.02013388e-03,9.22192931e-02,-1.14169739e-01,-6.25471398e-02,-7.63412844e-03,5.29423654e-02,1.69518501e-01,-2.44914368e-02,-4.37655076e-02,1.66987330e-01,-3.33075225e-02,4.13864255e-02,1.90281402e-02,9.10777077e-02,2.46177800e-03,-4.55477871e-02,-6.55916557e-02,-3.10473237e-03,-4.02890295e-02,-1.70472056e-01,-2.12542713e-04,7.25972354e-02,-2.65269011e-01,1.94183111e-01,8.99361670e-02,-2.56836135e-02,9.89286229e-02,-2.27259118e-02,-2.12507583e-02,-1.31608464e-03,2.12979823e-01,-3.51205587e-01,2.74906904e-01,2.04230517e-01,1.13111669e-02,1.17748439e-01,4.00286205e-02,1.06981196e-01,2.57537849e-02,6.92378357e-03,-1.54393032e-01,-6.81875497e-02,3.07280570e-05,-6.17604423e-03,1.25430766e-02,3.37549895e-02]],[[ 3.33601981e-02,2.18950808e-01,5.25589399e-02,-6.06435016e-02,-8.43613148e-02,7.20153004e-02,-6.08830974e-02,-8.34409371e-02,9.67382044e-02,-3.27746384e-04,2.91555285e-01,-4.84346934e-02,-2.59748727e-01,-6.66559637e-02,3.30047011e-02,1.45614624e-01,-2.04137906e-01,-1.10366166e-01,-1.42498747e-01,-3.80640477e-03,-1.71378646e-02,5.47722988e-02,6.41267151e-02,3.91335320e-03,-8.57527778e-02,-2.98490942e-01,-5.11459038e-02,-1.01354338e-01,1.27257884e-01,-1.28999814e-01,-4.14374061e-02,2.56892070e-02,-1.13893583e-01,-2.45535634e-02,6.04319125e-02,6.74173683e-02,-9.40101370e-02,-6.67680278e-02,1.88137412e-01,1.32872257e-03,-1.82188556e-01,4.39332426e-02,4.49893773e-02,2.36567542e-01,2.72193104e-01,1.17838997e-02,3.05325892e-02,-7.49155506e-02,3.77691165e-02,-2.66298920e-01,1.48846105e-01,1.64895594e-01,1.55318990e-01,1.38803110e-01,1.64481476e-02,-1.58437371e-01,1.97825730e-02,1.52800277e-01,-1.72297224e-01,8.14515352e-02,1.22895420e-01,-1.38855070e-01,-4.93918136e-02,1.82603858e-02,1.62638202e-01,1.25332266e-01,-1.04849547e-01,-1.97150543e-01,5.53290471e-02,-1.32151425e-01,-9.59372669e-02,1.17293313e-01,-1.40096560e-01,-9.66465995e-02,-2.62960464e-01,3.64195369e-02,3.95120800e-01,2.55586170e-02,-1.97585553e-01,-2.96364930e-02,-1.63999517e-02,-4.40649725e-02,1.55332964e-02,6.92601651e-02,-1.09604046e-01,-1.56740874e-01,-1.17389277e-01,3.95389833e-02,1.88643590e-01,-1.13158882e-01,-8.29163101e-03,1.95588186e-01,-3.58534269e-02,-8.23678449e-04,4.84100729e-02,1.09540187e-01,-3.94673832e-03,1.27359228e-02,-1.72595084e-02,-2.12953091e-02,6.26803562e-02,-1.98052153e-01,-6.99584559e-02,7.20234066e-02,-2.17735857e-01,1.60721123e-01,-1.33986981e-03,1.67240351e-02,1.30067334e-01,-5.92296720e-02,-1.77724455e-02,-4.66314182e-02,2.72649646e-01,-2.63336450e-01,2.49853805e-01,2.26347536e-01,2.04152986e-02,6.42477721e-02,3.84325832e-02,1.51295438e-01,6.71947282e-03,-1.82412043e-02,-1.52144179e-01,-6.57561570e-02,-4.76292893e-03,-1.88203622e-02,-3.31684798e-02,2.50659473e-02]],[[ 2.82088853e-03,1.88540086e-01,1.68683734e-02,-6.15225211e-02,-6.66730106e-02,9.25483927e-02,3.60094849e-03,-5.96660934e-02,1.67936683e-01,5.15804440e-02,2.56727725e-01,-3.05743832e-02,-2.75632173e-01,-9.82266143e-02,4.73604612e-02,1.32066280e-01,-1.86928630e-01,-1.10467285e-01,-1.12709492e-01,7.98108894e-03,-4.31619100e-02,6.35776296e-02,6.79053143e-02,1.44015867e-02,-8.84011164e-02,-2.98023641e-01,-3.90912741e-02,-1.25116169e-01,9.76984650e-02,-9.94135663e-02,3.06001399e-03,-7.61403609e-03,-1.88553363e-01,-1.57480519e-02,1.00236654e-01,7.26338178e-02,-9.02482495e-02,-5.35438582e-02,2.11272717e-01,1.75018534e-02,-2.12516204e-01,1.55753875e-03,4.49219495e-02,2.19748080e-01,1.73106432e-01,4.12785672e-02,5.25815338e-02,-6.54551387e-02,6.16361424e-02,-2.10121647e-01,1.38409883e-01,1.92241967e-01,1.80396318e-01,5.53400852e-02,2.47791149e-02,-2.10880712e-01,-5.11872470e-02,1.33346096e-01,-1.77311331e-01,7.78129473e-02,1.01757452e-01,-4.89850864e-02,-7.23917037e-02,-3.58456001e-02,1.46720067e-01,8.36935937e-02,-1.50431842e-01,-1.78618789e-01,1.38929337e-01,-1.36039600e-01,-4.11997065e-02,1.43187419e-01,-1.19545117e-01,-1.70583084e-01,-2.55052835e-01,1.76979043e-02,4.10075754e-01,1.73812360e-02,-1.80650592e-01,-5.94558157e-02,-6.30004108e-02,-2.35346705e-02,-6.34292066e-02,1.02112904e-01,-8.55509266e-02,-4.29085605e-02,-7.77176172e-02,1.18833035e-02,2.08374113e-01,-9.88899767e-02,-4.22141049e-03,1.64182067e-01,-3.29365134e-02,-2.23313347e-02,-3.83415073e-02,5.85192628e-02,3.04613076e-02,-6.51986338e-03,-3.01447697e-02,1.43439416e-02,-2.54644640e-02,-1.97629541e-01,-6.60173446e-02,5.97969070e-02,-2.76524663e-01,1.50484443e-01,6.61896765e-02,-5.83832599e-02,2.87721884e-02,9.68062668e-04,-3.71711180e-02,-2.21348181e-02,2.51920044e-01,-3.40805888e-01,2.91597039e-01,2.26792172e-01,1.19546121e-02,1.11737035e-01,-5.84540702e-03,1.46952957e-01,3.79731879e-02,-5.13361618e-02,-1.33946911e-01,-1.59345180e-01,-5.29028401e-02,-2.98120938e-02,-1.22097181e-02,2.81007364e-02]]])] 请求,该请求用于返回我的所有元素。但我似乎无法弄清楚如何按分组的数组(按名称和日期分组的)返回这些元素。

我的模型:

GET

这是我的 GET请求,用于返回所有元素:

public class Event
{
   [Key]
   public long ID { get; set; }

   [required]
   public DateTime date { get; set; }

   [required]
   public string name { get; set; }
}

解决方法

您可以这样定义DTO:

public class GroupedEventsDto
{
    public DateTime Date { get; set; }
    public string Name { get; set; }

    // although you already know date and name,// so you could have the list of IDs only
    public List<Event> Events { get; set; }
}

并简单地执行以下操作:

[HttpGet("api/events")]
public async Task<ActionResult<IEnumerable<GroupedEventsDto>>> GetEvents()
{
    var events = await context.Events.ToArrayAsync();

    var data = events 
       .GroupBy(x => new { x.date,x.name })
       .Select(grp => new GroupedEventsDto
       {
          Date = grp.Key.date,Name = grp.Key.name,Events = grp.ToList()
        })
        .ToList();

    return data;
}

这将生成类似JSON的

[
    {
        "Name": "a","Date": "2020-08-22","Events": [
            {
                "Name": "a","Id": 1
            },...
        ]
    },{
        "Name": "b","Events": [
            {
                "Name": "b","Id": 2
            },...
]

当然,您最终需要使用的属性将在GroupedEventsDto

中更改