Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

How to stop writer to write elements in alphabetical order?

2013-05-15
2014-04-19
  • wong wai lok
    wong wai lok
    2013-05-15

    I have the following problem when I am using Json::Value to write json string...

    Json::Value v;
    v["b"] = 5;
    v["c"] = 6;
    v["a"] = 7;

    cout << v << endl;

    The order in the created JSON output string:
    {
    "a" : 7,
    "b" : 5,
    "c" : 6
    }

    Is there anyway to have output as following?
    {
    "b" : 5,
    "c" : 6,
    "a" : 7

    }

     
    Last edit: wong wai lok 2013-05-15
  • We might provide a SortedWriter someday, but not before other features. Sorry.