![Build Status](https://camo.githubusercontent.com/ba41868492fbfd27a124cdac4269549c8825f6ab8d3f9d431f7877529c412de6/68747470733a2f2f7472617669732d63692e6f72672f4c6f6b692d4173746172692f54686f727353657269616c697a65722e7376673f6272616e63683d6d6173746572)
![ThorStream](/Loki-Astari/ThorsSerializer/raw/master/img/stream.jpg)
#include <iostream>
#include <vector>
#include "ThorSerialize/JsonThor.h"
enum class EnumType : int {
A, B, C
};
struct MyStruct {
EnumType e;
std::string s;
};
ThorsAnvil_MakeEnum(EnumType, A, B, C);
ThorsAnvil_MakeTrait(MyStruct, e, s);
int main()
{
using ThorsAnvil::Serialize::jsonImporter;
using ThorsAnvil::Serialize::jsonExporter;
MyStruct val;
std::cin >> jsonImporter(val);
std::cout << jsonExporter(val) << "\n";
}
> g++ -std=c++17 example0.cpp -lThorSerialize17 -lThorsLogging17
> # Note on mac you may need to add -I/opt/homebrew/include -L/opt/homebrew/lib/ on Mac's with M1 chip.
> echo '{"e": "A", "s": "This string"}' | ./a.out
{
"e": "A",
"s": "This string"
}