Every line of 'convert json to array in jquery' 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.
42 function 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 }
10 function convertToObject (array) { 11 const obj = [] 12 array.forEach((element, index, array) => { 13 obj[element[0]] = element[1] 14 }) 15 return obj 16 }
77 function jsonToArray(p_name) 78 { 79 var array = []; 80 var jsonArray = json.get(p_name); 81 for (var i = 0, j = jsonArray.length(); i < j; i++) 82 { 83 array.push(jsonArray.get(i)); 84 } 85 return array; 86 }
26 export function parseJson(json) { 27 return JSON.parse(json, function (k, v) { 28 if (v.indexOf && v.indexOf('function') > -1) { 29 try { 30 return eval('(function(){return ' + v + ' })()') 31 } catch (e) { 32 console.error(`[form-create]解析失败:${v}`); 33 return undefined; 34 } 35 } 36 return v; 37 }); 38 }
111 export function parseJson(json) { 112 return /** @type {?JsonObject} */ (JSON.parse(/** @type {string} */ (json))); 113 }
3 function convertStringToArray(string) { 4 let array = []; 5 try { 6 array = JSON.parse(string); 7 } catch (err) { 8 // Assume is just a string (single url) 9 if (string) { 10 array = [string]; 11 } 12 } 13 return array; 14 }
1 export function makeArray(value) { 2 return Array.isArray(value) ? value : value ? [value] : []; 3 }
15 function arrayParser(json) { 16 var result = '['; 17 for(var i=0;i
97 function convertToArray(object) { 98 if (Object.prototype.toString.call( object ) === '[object Object]' ) { 99 var array = []; 100 array.push(object) 101 return array; 102 } 103 else { 104 if( Object.prototype.toString.call( object ) === '[object Array]' ) { 105 return object; 106 } 107 } 108 }
6 function arrayify (o) { 7 if (Array.isArray(o)) { 8 return o 9 } else { 10 return [o] 11 } 12 }