Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Returning JSON data from a REST Web Server

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 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:

The last piece of code is the code that produce the AsJSON() function call.

For each structure, there is a AsJSON and a FromJSON

You can see the result on the console output of the Server. On the client side, ask the method called ‘leave’.

You can download the C++ client and server.

Share the post

Returning JSON data from a REST Web Server

×

Subscribe to Msdn Blogs | Get The Latest Information, Insights, Announcements, And News From Microsoft Experts And Developers In The Msdn Blogs.

Get updates delivered right to your inbox!

Thank you for your subscription

×