Skip to content
Advertisement

Unable to change/fetch the JSON value using REGEX and it returned Undefined

I’m trying to fetch the value of currency from the JSON file and if it’s USD then I need to change it to AUD.

When I tried to search the currency attribute in the json file return undefined as below:

Code:

JavaScript

Output: Got undefined

data.json:

JavaScript

Can someone help me how to update the currency value in the JSON file and why it’s returning ‘undefined’

Thanks in advance.

Updated:

The data.json is dynamic json file and the structure will differ in every few minutes of interval. I’m only interested to get currency attribute which is always available from the data.json file and update the json before invoke it to server.

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement