Know when it is no longer JSON
Do you ever call your variables that get populated from a JSON string something with “json” in them?
function processData(json) {
// if (json.accountType == "savings") ...
}
Realize that “JSON” only describes the format of the data you’re fetching through XHR or <script>. It is a string representation of an object. When you’re in the JavaScript domain, and about to process the parsed result of the JSON string, leave “json” behind:
function processData(obj) {
// if (obj.accountType == "savings") ...
}