Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Madokakaroto
authored and
Madokakaroto
committed
Apr 6, 2017
1 parent
a965c5f
commit 25b442e
Showing
3 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,5 @@ | |
*.exe | ||
*.out | ||
*.app | ||
|
||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <iguana/json.hpp> | ||
|
||
namespace client | ||
{ | ||
struct person | ||
{ | ||
std::string name; | ||
int age; | ||
}; | ||
|
||
REFLECTION(person, name, age); | ||
} | ||
|
||
int main(void) | ||
{ | ||
client::person p = { "zombie chow", 31 }; | ||
|
||
iguana::string_stream ss; | ||
iguana::json::to_json(ss, p); | ||
|
||
auto json_str = ss.str(); | ||
std::cout << json_str << std::endl; | ||
|
||
client::person p2; | ||
iguana::json::from_json(p2, json_str.data(), json_str.length()); | ||
|
||
std::cout << p2.name << " - " << p2.age << std::endl; | ||
return 0; | ||
} |