Skip to content
Advertisement

Why am i getting ‘undefined’ from this JSON object? [closed]

JavaScript

callCostCatalog is an Apex method which returns the string:

JavaScript

Advertisement

Answer

Your JSON.parse is right, and your console.log is right, and your JSON is valid.

However, you have erroneously called JSON.stringify, which is like the reverse of parse, taking a JavaScript object and producing a string of JSON. You don’t want that; you already have a string of JSON. Simply remove it.

Advertisement