I'm trying to register a user via a XenForo API add-on, which returns information in the form of JSON. I need to be able to check if any errors are in the JSON response, and if they are, go through each one, and send the message to the player; meaning I'd have to loop through "errors".
Here's what the JSON file would look like:
Obviously what the API returns is dynamic, so you won't always have an error for email or username, and could possibly have an error for something else. On top of that, if it's successful, it'll send the newly created users information, as oppose to any errors. Any help would be appreciated.
Here's what the JSON file would look like:
Code:
{
"errors":{
"email":"Email addresses must be unique. The specified email address is already in use.",
"username":"Usernames must be unique. The specified username is already in use."
},
"system_info":{
"visitor_id":0,
"time":1398536381
}
}
Obviously what the API returns is dynamic, so you won't always have an error for email or username, and could possibly have an error for something else. On top of that, if it's successful, it'll send the newly created users information, as oppose to any errors. Any help would be appreciated.