X Xiaofy New Member Sep 12, 2022 #1 I try to parse this XML file and generate JSON. Why is the data order of the generated JSON file different from that of the original XML? Instead, it is sorted the same. Why can't we generate JSON files in the same order as the original data. I am not good at communicating with others in English. Original XML file: Why shouldn't it be generated { "NOTE": "This XML file should only be used for documentation purposes.", "doclet-version-NOT-library-version": "0", "class": {....} }
I try to parse this XML file and generate JSON. Why is the data order of the generated JSON file different from that of the original XML? Instead, it is sorted the same. Why can't we generate JSON files in the same order as the original data. I am not good at communicating with others in English. Original XML file: Why shouldn't it be generated { "NOTE": "This XML file should only be used for documentation purposes.", "doclet-version-NOT-library-version": "0", "class": {....} }
Erel B4X founder Staff member Licensed User Longtime User Sep 12, 2022 #2 Hash maps usually do not retain order. If the order is important then you should use a list. The JSON parsers do not preserve the keys order. Upvote 0
Hash maps usually do not retain order. If the order is important then you should use a list. The JSON parsers do not preserve the keys order.
X Xiaofy New Member Sep 12, 2022 #3 Erel said: Hash maps usually do not retain order. If the order is important then you should use a list. The JSON parsers do not preserve the keys order. Click to expand... Thanks. I'll do it right away. Upvote 0
Erel said: Hash maps usually do not retain order. If the order is important then you should use a list. The JSON parsers do not preserve the keys order. Click to expand... Thanks. I'll do it right away.