Al Ivon Al Ivon - 4 years ago 131
Javascript Question

jQuery - traversing through Json object

I have the following Json object:

Object {success: false, errors: "{"email": [{"message": "Enter a valid email address.", "code": "invalid"}]}"}

This is response of Django
method. I need to process the error message Enter a valid email address. I'm using jQuery. I tried many ways but with no success.
return this

{"email": [{"message": "Enter a valid email address.", "code": "invalid"}]}

but then
and I didn't find a way to get it correct.

How I can get the message only?

Answer Source

If errors, in your case, is represented by a string, you may need to do the following:


Well, that's what I'd do, assuming I'm reading your message right.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download