Every line of 'js convert json to array' 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.
26 export function fromJSON(json: ValueJSON): Value { 27 if (json === null) 28 return undefined; 29 if (isNestedContentValue(json)) 30 return json.map(NestedContentValue.fromJSON); 31 if (isArrayValue(json)) 32 return valuesArrayFromJSON(json); 33 if (isMapValue(json)) 34 return valuesMapFromJSON(json); 35 return json; 36 }
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 }
38 function arrayFrom(json) { 39 var queue = [], next = json; 40 while (next !== undefined) { 41 if ($.type(next) == "array") 42 return next; 43 if ($.type(next) == "object") { 44 for (var key in next) 45 queue.push(next[key]); 46 } 47 next = queue.shift(); 48 } 49 // none found, consider the whole object a row 50 return [json]; 51 }
92 function fromJSON(json) { 93 var classes = Class._classes, 94 mathClasses = Mathf._classes; 95 96 if (typeof(json) !== "object") { 97 return json; 98 } else if (mathClasses[json._className]) { 99 return Mathf.fromJSON(json); 100 } else if (classes[json._className]) { 101 return Class.fromJSON(json); 102 } else { 103 return json; 104 } 105 106 return null; 107 }
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 }
15 function arrayParser(json) { 16 var result = '['; 17 for(var i=0;i
109 export function listFromJSON(json: NodeJSON[] | string): Node[] { 110 if (typeof json === "string") 111 return JSON.parse(json, listReviver); 112 return json.map((m) => fromJSON(m)); 113 }
80 export function fromJson (json) { 81 return isString(json) ? JSON.parse(json) : json 82 }
10 function convertToObject (array) { 11 const obj = [] 12 array.forEach((element, index, array) => { 13 obj[element[0]] = element[1] 14 }) 15 return obj 16 }
836 function cloneJSON(o: any): any { 837 if (typeof o !== "object" || o === null) { 838 return o 839 } 840 if (Array.isArray(o)) { 841 return o.map(cloneJSON) 842 } 843 let r = {} as any 844 for (let key in o) { 845 r[key] = cloneJSON(o[key]) 846 } 847 return r 848 }