Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when providing json on run-time - ReferenceError: key is not defined #194

Open
jarnakantaria-gep opened this issue Sep 10, 2020 · 0 comments

Comments

@jarnakantaria-gep
Copy link

My initial json looks like

localization_en-US.js

let myArray = [
{ key: "key1", value: "value1"},
{ key: "key2", value: "value2"}
{ key: "key3", value: "value3"}
{ key: "key4", value: "value4"}
]
    let finalJson = {};
    for (var i = 0; i< enArray.length; i++) {
        finalJson[enArray[i].key] = enArray[i].value
    }
    console.log("en ARR = ", finalJson)

export default finalJson;

I get an error : ReferenceError: key is not defined and the app doesn't open.

I need to provide that enArray json because i am convering csv to json and that key-value is the kind of response I receive. and react-native-localization expects the json in other format, which I am doing via the for loop.

Any solution you can think of?
I need to push this to release on immediate basis.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant