C++ Rest giving me an error when trying to show JSON file from web
<p>I am trying to make a program that can display a JSON file in console with C++'s REST API. I'm trying to get the JSON file from api.trello.com but every example I come across gives me an error, usually about <code>cbegin()</code> &amp; <code>cend()</code> and how it is not a value of <code>web::json::value</code>...</p>

<p>here is my code:</p>

<pre><code>// The code includes the most frequently used includes necessary to work with C++ REST SDK
#include "cpprest/containerstream.h"
#include "cpprest/filestream.h"
#include "cpprest/http_client.h"
#include "cpprest/json.h"
#include "cpprest/producerconsumerstream.h"
#include &lt;iostream&gt;
#include &lt;sstream&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

using namespace ::pplx;
using namespace utility;
using namespace concurrency::streams;

using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace web::json;
using namespace std;


using namespace web;
using namespace web::http;
using namespace web::http::client;

// Retrieves a JSON value from an HTTP request.
pplx::task&lt;void&gt; RequestJSONValueAsync()
{
    // TODO: To successfully use this example, you must perform the request  
    // against a server that provides JSON data.  
    // This example fails because the returned Content-Type is text/html and not application/json.
    http_client client(L"website.com/theRealURLContainsSecretKeys");
    return client.request(methods::GET).then([](http_response response) -&gt; pplx::task&lt;json::value&gt;
    {
        if (response.status_code() == status_codes::OK)
        {
            return response.extract_json();
        }

        // Handle error cases, for now return empty json value... 
        return pplx::task_from_result(json::value());
    })
        .then([](pplx::task&lt;json::value&gt; previousTask)
    {
        try
        {
            const json::value&amp; v = previousTask.get();
            // Perform actions here to process the JSON value...
        }
        catch (const http_exception&amp; e)
        {
            // Print error.
            wostringstream ss;
            ss &lt;&lt; e.what() &lt;&lt; endl;
            wcout &lt;&lt; ss.str();
        }
    });

    /* Output:
    Content-Type must be application/json to extract (is: text/html)
    */
}

// Demonstrates how to iterate over a JSON object. 

void IterateJSONValue()
{
    // Create a JSON object.
    json::value obj;
    obj[L"key1"] = json::value::boolean(false);
    obj[L"key2"] = json::value::number(44);
    obj[L"key3"] = json::value::number(43.6);
    obj[L"key4"] = json::value::string(U("str"));

    // Loop over each element in the object. 
    for (auto iter = obj.cbegin(); iter != obj.cend(); ++iter)
    {
        // Make sure to get the value as const reference otherwise you will end up copying 
        // the whole JSON value recursively which can be expensive if it is a nested object. 
        const json::value &amp;str = iter-&gt;first;
        const json::value &amp;v = iter-&gt;second;

        // Perform actions here to process each string and value in the JSON object...
        std::wcout &lt;&lt; L"String: " &lt;&lt; str.as_string() &lt;&lt; L", Value: " &lt;&lt; v.to_string() &lt;&lt; endl;
    }

    /* Output:
    String: key1, Value: false
    String: key2, Value: 44
    String: key3, Value: 43.6
    String: key4, Value: str
    */
}
int wmain()
{
    // This example uses the task::wait method to ensure that async operations complete before the app exits.  
    // In most apps, you typically don�t wait for async operations to complete.

    wcout &lt;&lt; L"Calling RequestJSONValueAsync..." &lt;&lt; endl;
    RequestJSONValueAsync().wait();

    wcout &lt;&lt; L"Calling IterateJSONValue..." &lt;&lt; endl;
    //IterateJSONValue();
    system("pause");
}
</code></pre>

<p>I am having this error in VS 2015.</p>

<p>The only errors are in <code>IterateJSONValue()</code></p>

<p>What is my problem and how can I fix it?</p>