Lines Matching refs:builder
181 function BasicSerializeArray(value, stack, builder) { argument
184 builder.push("[]");
190 builder.push("[");
197 builder[builder.length - 1] = array_string;
201 builder.push(%QuoteJSONString(val));
205 builder.push(%QuoteJSONStringComma(val));
207 builder.push(",");
208 var before = builder.length;
209 BasicJSONSerialize(i, val, stack, builder);
210 if (before == builder.length) builder[before - 1] = ",null";
216 builder.push(JSON_NUMBER_TO_STRING(val));
218 builder.push(",");
221 builder.push(JSON_NUMBER_TO_STRING(val));
223 var before = builder.length;
224 BasicJSONSerialize(i, val, stack, builder);
225 if (before == builder.length) builder[before - 1] = ",null";
229 var before = builder.length;
230 BasicJSONSerialize(0, val, stack, builder);
231 if (before == builder.length) builder.push("null");
233 builder.push(",");
234 before = builder.length;
235 BasicJSONSerialize(i, value[i], stack, builder);
236 if (before == builder.length) builder[before - 1] = ",null";
240 builder.push("]");
244 function BasicSerializeObject(value, stack, builder) { argument
248 builder.push("{");
253 builder.push(%QuoteJSONStringComma(p));
255 builder.push(%QuoteJSONString(p));
257 builder.push(":");
258 var before = builder.length;
259 BasicJSONSerialize(p, value[p], stack, builder);
260 if (before == builder.length) {
261 builder.pop();
262 builder.pop();
269 builder.push("}");
273 function BasicJSONSerialize(key, value, stack, builder) { argument
281 builder.push(value !== "" ? %QuoteJSONString(value) : '""');
283 builder.push(JSON_NUMBER_TO_STRING(value));
285 builder.push(value ? "true" : "false");
287 builder.push("null");
293 builder.push(JSON_NUMBER_TO_STRING(value));
295 builder.push(%QuoteJSONString(ToString(value)));
297 builder.push(%_ValueOf(value) ? "true" : "false");
299 BasicSerializeArray(value, stack, builder);
301 BasicSerializeObject(value, stack, builder);
309 var builder = new InternalArray();
310 BasicJSONSerialize('', value, new InternalArray(), builder);
311 if (builder.length == 0) return;
312 var result = %_FastAsciiArrayJoin(builder, "");
314 return %StringBuilderConcat(builder, builder.length, "");