Skip to content
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

Printing a json-array without sorting the keys #1776

Open
tellass567 opened this issue Nov 3, 2023 · 0 comments
Open

Printing a json-array without sorting the keys #1776

tellass567 opened this issue Nov 3, 2023 · 0 comments

Comments

@tellass567
Copy link

Hello,
I would like an json-array to be printed unsorted.
This is the code to initialize the array

web::json::value array = web::json::value::array();
int i=0;
for (...)
{
   
   array[i][L"YYY"]=...
   array[i][L"XXX"]=...
   array[i][L"ZZZ"]=...
   ...
   array[i][L"AAA"]=...
   ++i;
}
std::wstringstream ss;
array.serialize(ss);
std::string s= convertWStringToString(ss.str());

The problem is that the json is printed like that: AAA=..,..,XXX=..., YYY=..., ZZZ=...
The array is obviously sorted.
I want that the array is printed without sorting the keys: YYY=..., XXX=..., ZZZ=..., AAA=...

Any hints?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant