You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Takes a JSON object and convert it to a readable sentence
Params
str - JSON string or plain object
withKeys - Boolean - should returned array contains keys
Example
json = {
email: ["must be at least 6 characters", "must contain a number and a letter"]
}
withoutKeys = window.utilityBox.formatJSONErrors(json)
withKeys = window.utilityBox.formatJSONErrors(json, true)
Outputs
withoutKeys: ["email must be at least 6 characters and must contain a number and a letter"]
withKeys: [{email: "email must be at least 6 characters and must contain a number and a letter"}]