Skip to content

JSON DataProvider (or RepeaterBlock) changes the sorting of the json array returned as data #16079

Closed Answered by andz-bb
esellier asked this question in Help
Discussion options

You must be logged in to vote

hey @esellier,

it sorts alphabetically on the first key of the object in the array. You could add a property like index to the start of each object with ascending numbers to force the objects to remain sorted how you want them to be.

here's a json object I had where it was being sorted by year because it was the first key of the first object:

if I want it to sort based on the raw order of the object itself, I can add some js like so:

const your_array = [] // your json array
return your_array.map((object, i) => ({ index: i + 1, ...object }));

hope this helps - if you have any questions on this let me know

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by andz-bb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
bug Something isn't working customer Created by Linear-GitHub Sync premium-business
2 participants
Converted from issue

This discussion was converted from issue #15932 on May 06, 2025 13:34.