-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON fields are ordered differently when exceeding 8 fields per object #10699
Comments
Nevermind, I tried to test with the 2nd block structure posted and it didn't change but if I use the first structure and add the extra entry to the bottom I see that it changes the order now. |
Unsure of source, it could be something the Content-Manager is doing or it could have something to do with the backend. 🤔 |
I observe a similar problem. This is what the json data looks like in the JSON field: {
"pilot": {
"route": "/pilot",
"btn_txt": "To Pilot Experiment",
"btn_type": "success"
},
"experiment": {
...
},
"playground": {
...
},
"introduction": {
...
}
} If I want to change to order and put {
"introduction": {
"route": "/Introduction",
"btn_txt": "Introduction",
"btn_type": "success"
}
"pilot": {
...
},
"experiment": {
...
},
"playground": {
...
}
} strapi does not accept this and instead saves the old version again. This only happens in production mode, not in development. (And currently I only tested Strapi v3.) |
Can you please test this on v4, we won't be fixing issues on v3 anymore unless they are critical or security related |
I'm using |
I've just tested my issue in strapi v4, too, and the problem is the same. To sum up:
|
Facing the same issue. |
Facing the same as well |
Can't reproduce on v4.1.8 using SQLite. Marking as closed until additional information is given to reproduce |
I'm using strapi@4.3.2 right now, default type for JSON field on postgres for strapi is jsonb, so i update the field json to json . After saving JSON file, the order of objects was ordered as entered. If you want your keys order not to change, you can use the json type that does not change the order of the keys when storing the data in the database. Hope it helps. |
works like a charm 👍 |
I am using Strapi v4.8.2 and have tried to change the datatype directly on PostgreSQL server (from |
I have strapi 3, so I can't change from jsonb to json, did anybody find a solution. This is real important, I have to show some properties in certain order |
Facing this issue on Strapi v4.10.4 |
Did you resolve that issue? |
m facing same issue, do you have any solution to fix it? |
what you did to reslve it bro? |
This issue has been mentioned on Strapi Community Forum. There might be relevant details there: |
Bug report
Describe the bug
I have a JSON data field in one of my content types. It works perfectly fine until the number of fields inside the JSON object is either 8 or less than 8. As soon as I introduce field number 9, the order of JSON fields gets changed.
Steps to reproduce the behavior
Expected behavior
The ordering of fields should not change. Items should be ordered as entered.
Code snippets
Let’s say I have a Person type JSON-LD object and I add only 8 fields in this format:
Until this moment, it is perfectly fine.
But if I add a new field like “memberOf”, then the ordering of the fields gets changed.
The whole ordering of fields has been changed by introducing field 9.
System
The text was updated successfully, but these errors were encountered: