-1

Here is what I have now:

 console.log(JSON.stringify(errorParam))
 {"data":{"message":"{\"ErrorLine\":113,\"ErrorMessage\":\"Authentication Failed\",\"ErrorNumber\":50004,\"ErrorProcedure\":\"start_test\"}"},"status":400,"statusText":"Bad Request"}

I know about JSON.stringify but how can I convert this back into an object from a string?

Alan2
  • 23,493
  • 79
  • 256
  • 450

1 Answers1

2

I know about JSON.stringify but how can I convert this back into an object from a string?

Use JSON.parse

console.log(JSON.parse('{"data":{"message":"{\"ErrorLine\":113,\"ErrorMessage\":\"Authentication Failed\",\"ErrorNumber\":50004,\"ErrorProcedure\":\"start_test\"}"},"status":400,"statusText":"Bad Request"}'));
gurvinder372
  • 66,980
  • 10
  • 72
  • 94