We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I saw a similar question: #470 but it did not work
expected output
[ { "date": 1588125626000, "dateString": "2020-04-29T02:00:26.000Z", "device": "share2", "direction": "Flat", "sgv": 123, "sysTime": "2020-04-27T03:10:18.000Z", "trend": 4, "type": "sgv", "utcOffset": 0 }, { "date": 1588125927000, "dateString": "2020-04-29T02:05:26.000Z", "device": "share2", "direction": "Flat", "sgv": 125, "sysTime": "2020-04-27T03:05:18.000Z", "trend": 4, "type": "sgv", "utcOffset": 0 } ]
of the many things I tried:
json js; for( auto item : vItem ) { string strDT; string strST; common::timeTickToString( item.DT, strDT ); common::timeTickToString( item.DT, strST ); json jsItem = { { { "sgv", item.value }, { "date", item.DT }, { "dateString", strDT.c_str() }, { "trend", item.trend }, { "direction", "Flat" }, { "device", "share2" }, { "type", "sgv" }, { "utcOffset", 0 }, { "sysTime", strST.c_str() } } }; js.push_back( jsItem ); }
The result I get is:
[ { "date": 1588115726000, "dateString": "2020-04-28T23:15:26+0000", "device": "share2", "direction": "Flat", "sgv": 123, "sysTime": "2020-04-28T23:15:26+0000", "trend": 4, "type": "sgv", "utcOffset": 0 } ], [ { "date": 1588115427000, "dateString": "2020-04-28T23:10:27+0000", "device": "share2", "direction": "Flat", "sgv": 123, "sysTime": "2020-04-28T23:10:27+0000", "trend": 4, "type": "sgv", "utcOffset": 0 } ] ]
Any help would be appreciated, thank you
The text was updated successfully, but these errors were encountered:
There is one set of braces too many. Try this:
json jsItem = { { "sgv", item.value }, { "date", item.DT }, { "dateString", strDT.c_str() }, { "trend", item.trend }, { "direction", "Flat" }, { "device", "share2" }, { "type", "sgv" }, { "utcOffset", 0 }, { "sysTime", strST.c_str() } };
Sorry, something went wrong.
thank you :) fixed the problem
No branches or pull requests
I saw a similar question: #470
but it did not work
expected output
of the many things I tried:
The result I get is:
Any help would be appreciated,
thank you
The text was updated successfully, but these errors were encountered: