How to use 'json to array javascript' in JavaScript

Every line of 'json to array javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
42function translateArraysToJSON(keys, value) {
43 const MyJSON = {};
44 let index = 0;
45 for (const item of keys) {
46 const currentKeys = item.split(".");
47 let currentKey = "";
48 for (let el of currentKeys) {
49 currentKey += `["` + el + `"]`;
50 if (!eval("MyJSON" + currentKey)) {
51 eval("MyJSON" + currentKey + "={}");
52 }
53 }
54 eval("MyJSON" + currentKey + "=" + "`" + value[index++] + "`");
55 }
56 return MyJSON;
57}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code


Related snippets