Skip to content
This repository was archived by the owner on Jun 1, 2026. It is now read-only.
This repository was archived by the owner on Jun 1, 2026. It is now read-only.

Printing a json-array without sorting the keys  #1776

Description

@tellass567

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions