In the below json file i want to sort in descending order the content within docs field. There are two blocks . The data is dynamic meaning there can be multiple blocks-- it can be 5, it can be 10 such block within docs.
{
"Scoring":1.68466776,
"_text_":[
],
"id":"health_analytics.pdf",
"jac_Score":0.07370184254606366,
"matchScore":0.65,
"scaledTf_idf":0.0,
"searchTerm":[
"Machine learning",
"Deep learning",
"R",
"Python",
"Sas"
],
"sortingScore":59.78
}
and,
{
"Scoring":2.029842275,
"_text_":[
],
"id":"customer_channel_analytics_bang.pdf",
"jac_Score":0.09041591320072333,
"matchScore":0.6875,
"scaledTf_idf":0.0,
"searchTerm":[
"Machine learning",
"Deep learning",
"Sas",
"R"
],
"sortingScore":44.03
},
I want to sort this using the Sortingscoring which is one of the fields within docs. The whole chunks(in this case there are two) within docs should be sorted.So after sorting the final json should be like below. I have referred to few of the stackoverflow links sort json object in javascript but not able to get it.
{
"statusCode":200,
"body":{
"docs":[
{
"Scoring":2.029842275,
"_text_":[
],
"id":"customer_channel_analytics_bang.pdf",
"jac_Score":0.09041591320072333,
"matchScore":0.6875,
"scaledTf_idf":0.0,
"searchTerm":[
"Machine learning",
"Deep learning",
"Sas",
"R"
],
"sortingScore":44.03
},
{
"Scoring":1.68466776,
"_text_":[
],
"id":"health_analytics.pdf",
"jac_Score":0.07370184254606366,
"matchScore":0.65,
"scaledTf_idf":0.0,
"searchTerm":[
"Machine learning",
"Deep learning",
"R",
"Python",
"Sas"
],
"sortingScore":59.78
}
]
}
}