mirror of
https://github.com/stefanocasazza/ULib.git
synced 2025-09-28 19:05:55 +08:00
32 lines
505 B
C++
32 lines
505 B
C++
// test_json.cpp
|
|
|
|
#include <ulib/file.h>
|
|
#include <ulib/json/value.h>
|
|
|
|
int
|
|
U_EXPORT main (int argc, char* argv[])
|
|
{
|
|
U_ULIB_INIT(argv);
|
|
|
|
U_TRACE(5,"main(%d)",argc)
|
|
|
|
UValue json;
|
|
UString filename, content, result;
|
|
|
|
while (cin >> filename)
|
|
{
|
|
content = UFile::contentOf(filename);
|
|
|
|
if (json.parse(content))
|
|
{
|
|
result.setBuffer(U_CAPACITY);
|
|
|
|
UValue::stringify(result, json);
|
|
|
|
cout << result << '\n';
|
|
}
|
|
|
|
json.clear();
|
|
}
|
|
}
|