Convert JSON status code ("400") to object

  • 18 March 2021
  • 2 replies

What Javascript/other tools would you use to convert a JSON response code (“400”) into an object? That is, if there’s no other content, but I want to “generate” content out of the status code.

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 1

Maybe try using try-catch to handle that error?


In the catch section of your code, you should be able to use the error message. 


Here's a link to try-catch:

Userlevel 3
Badge +6

Hey @averycampbell, hope you’re well, I just wanted to check in here!

Were you able to get things going with the information from Jhealyn, or can we still help here?

I believe the Try-Catch recommendation would be a solid place to start for catching errors. The main difference from the example is that you want to return a JSON object vs generating HTML into an HTML p tag.