Every line of 'json.stringify remove quotes' 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.
28 function JSON_stringify(s, emit_unicode) { 29 if (s) { 30 var json = JSON.stringify(s); 31 if (json) { 32 return emit_unicode ? json : json.replace(jsonRegex, jsonRegexReplace); 33 } 34 else { 35 return json; 36 } 37 } 38 else { 39 return s; 40 } 41 }
23 export function jsonStringify(value: any) { 24 return JSON.stringify(value, replacer) 25 }
15 function purifySingleQuoteJSON(input: string): string { 16 return input.replace(/'/g, '"'); 17 }
56 function stringifyObjectWithoutQuotes(obj) { 57 return tosource(obj); 58 }
18 function safeJSON(json) { 19 return json.replace(safeJSONRegExp, safeJSONReplacer); 20 }
5 function json_encode(v) { 6 switch (typeof v) { 7 case 'string': 8 case 'number': 9 case 'boolean': 10 return json_encodeString(v); 11 case 'object': 12 if (v) { 13 if (v instanceof Array) { 14 return json_encodeArray(v); 15 } else { 16 return json_encodeObject(v); 17 } 18 } else return 'null'; 19 } 20 return 'null'; 21 }
8 function stringify (val) { 9 return JSON.stringify(val, null, 2) 10 }
8 function tryStringify (obj) { 9 if (typeof obj !== 'object' || !JSON.stringify) return obj 10 return JSON.stringify(obj) 11 }
140 function stringify(obj) { 141 // Implement a stable JSON.stringify 142 // Object's keys are alphabetically ordered 143 var key, 144 key_list, 145 i, 146 value, 147 result_list; 148 if (obj === undefined) { 149 return undefined; 150 } 151 if (obj === null) { 152 return 'null'; 153 } 154 if (obj.constructor === Object) { 155 key_list = Object.keys(obj).sort(); 156 result_list = []; 157 for (i = 0; i < key_list.length; i += 1) { 158 key = key_list[i]; 159 value = stringify(obj[key]); 160 if (value !== undefined) { 161 result_list.push(stringify(key) + ':' + value); 162 } 163 } 164 return '{' + result_list.join(',') + '}'; 165 } 166 if (obj.constructor === Array) { 167 result_list = []; 168 for (i = 0; i < obj.length; i += 1) { 169 result_list.push(stringify(obj[i])); 170 } 171 return '[' + result_list.join(',') + ']'; 172 } 173 return JSON.stringify(obj); 174 }
216 function prettyPrintJson(obj, indent) { 217 var result = ''; 218 219 if (indent == null) indent = ''; 220 221 for (var property in obj) { 222 if (property.charAt(0) !== '_') { 223 var value = obj[property]; 224 225 if (typeof value === 'string') { 226 value = '\'' + value + '\''; 227 } else if (typeof value === 'object') { 228 if (value instanceof Array) { 229 value = '[ ' + value + ' ]'; 230 } else { 231 // Recursive dump 232 var od = prettyPrintJson(value, indent + ' '); 233 234 value = '{\n' + od + '\n' + indent + '}'; 235 } 236 } 237 result += indent + property + ': ' + value + ',\n'; 238 } 239 } 240 return result.replace(/,\n$/, ''); 241 }