-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
3000 release annouced the deprecation of json_decode_dict is not equalivant as tojson #55911
Comments
I was looking at the documentation and it doesn't appear to have anything indicating that the output between those 2 flags are different, just that Here's the docs page for reference too... https://jinja.palletsprojects.com/en/2.10.x/templates/#tojson |
Depending on what output we're trying to cast, order might be imporant. For me a lot of things I had in a specific order got sorted alphabetically. e.g. some share templates showed up after the share that used them, resulting in errors in the smb.conf |
Understood, so it seems quite undesirable especially when it isn't clear to the user. Thanks for the report! |
@sjorge To retain the same functionality, use
The |
@waynew should the release ntoes be updated then? It says the json_decode_dict is deprecated and to use tojson instead... ? Edit: yep using |
If one wanted the correct behavior of a function called Basically you could think of it as being called "undo" when it should have been "do". And for most cases, people were looking for "do", and I'm going to go ahead and close this issue, but reproducing it has exposed a potential issue when migrating from 2 to 3. |
Description of Issue
With the 3000rc dropping the deprecation of
json_decode_dict
in the next release was announced. The new way to do it is to usetojson
.In prepare my states and pillars before upgrading from 2018.2.3 to 3000rc2 I noticed issues when replacing
json_decode_dict
withtojson
.json_decode_dict would output an in the order it was received, tojson will output the keys sorted alphabetically!
Setup
Steps to Reproduce Issue
I provided a basic test state to see it in action, notice the different order between tosjon and json_decode_dict
Versions Report
The text was updated successfully, but these errors were encountered: