To return data on a rest web server, you have to provide JSON data file format. To illustrate the sample (see my previous post), I have decided to return a simple structure:
- std::vector<People> peoples
- utility::string_t job
The People structure contains just:
- utility::string_t name
- double age
I have made a little modification on my PUT handler to return data:
Image may be NSFW.
Clik here to view.
The last piece of code is the code that produce the AsJSON() function call.
For each structure, there is a AsJSON and a FromJSON
Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.
You can see the result on the console output of the server. On the client side, ask the method called ‘leave’.
Image may be NSFW.
Clik here to view.