Access value in JSON dictionary returned from Stripe API in Meteor
<p>the Stripe API is returning me a JSON dictionary (whatever that is) when the Stripe oAuth process fails. I have stored that as a variable, but I cannot access the value in side it "error_description". <a href="https://stripe.com/docs/connect/reference#get-authorize-errors" rel="nofollow">Here is a link to the relevant Stripe docs</a></p>

<p>Not sure if it makes a difference, but this is in a Meteor app in a server side method.</p>

<p>I have the following stored as a variable called "error". This is what I get when I console.log(error); </p>

<pre><code>{ [Error: failed [400] {   "error": "invalid_grant",   "error_description": "Authorization code does not exist: ac_7z4pnJ8ee71yJNxguV6wiINIf10fgl6j" }] stack: [Getter] }
</code></pre>

<p>My question is: How can I access the "error_description"?</p>

<p>It doesn't seem to work when I write</p>

<pre><code>var newError = error.error_description
</code></pre>

<p>If anyone can help me get the error_description that would be awesome, thanks!</p>

<p><strong>Update</strong>
Adding .message removed part of the response, but I still can't JSON.parse it or access the error_description</p>

<p>var error = error.message results in</p>

<pre><code>failed [400] {   "error": "invalid_grant",   "error_description": "Authorization code does not exist: ac_7z4pnJ8ee71yJNxguV6wiINIf10fgl6j" }
</code></pre>