Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: How serialize/deserialize a JSON vector of data structure record?

$
0
0
Hi,

I am trying to use Json to serialize/de-serialize vector of json record. I am new at this JSON.

How do you serialize/de-serialize entire json vector into stream?

Thank You

Mike

Example:
utility::stringstream_t streamOutput;
std::vector<json::value> jsonVector;

for (int i = 0; i < updatelist.GetCount(); i++)
{
FILETIME *ftFileModify;
SYSTEMTIME stUTC;
json::value jsonObj;

__int64 temp = updatelist[i].GetLastWriteTime();
 ftFileModify = (FILETIME *)&temp;
 FileTimeToSystemTime(ftFileModify, &stUTC);

  jsonObj[L"wYear"] = json::value::number(stUTC.wYear);
  jsonObj[L"wMonth"] = json::value::number(stUTC.wMonth);
  jsonObj[L"wDayOfWeek"] = json::value::number(stUTC.wDayOfWeek);
  jsonObj[L"wDay"] = json::value::number(stUTC.wDay);
  jsonObj[L"wHour"] = json::value::number(stUTC.wHour);
  jsonObj[L"wMinute"] = json::value::number(stUTC.wMinute);
  jsonObj[L"wSecond"] = json::value::number(stUTC.wSecond);
  jsonObj[L"wMilliseconds"] = json::value::number(stUTC.wMilliseconds);
  jsonVector.push_back(jsonObj);
}

//TODO: How to Serialize jsonVector into text stream?

Viewing all articles
Browse latest Browse all 4845


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>