Notes › Tech Notes › Paste 133 Characters, Copy Out 149: Six Rewrites of Value Text in the JSON View

Paste 133 Characters, Copy Out 149: Six Rewrites of Value Text in the JSON View

Paste 133 characters of JSON into this page and copy back 149: a big integer rounds to its neighbour, -0 loses the minus sign, 1.2300 drops trailing zeros, 1e-6 expands into decimals, and Compress writes the rewritten text back into the input box. Six rewrites of value text, measured one by one.

133 Characters In, 149 Characters Out

It started with two counts that refused to reconcile. A 133-character escape sample pasted into this page, formatted, then copied from the right-hand button, came back as 149 characters. Nothing looked different at a glance; the text had simply been "seen" by this page, and the length grew. The second sample was subtler: {"v":9007199254740993}, which the tree displayed as 9007199254740992, the last digit moving from 3 to 2; feed in 9007199254740995 and the display reads 9007199254740996, a change in the opposite direction.

Taken together these point at one question: when this page renders JSON back into text, the value text is not handed back the way it arrived. I sorted the inputs I could think of into six classes and measured them one by one, namely big-integer precision, decimal normalization, the exponent and digit-count boundary, string escapes, duplicate keys and key order, and state residue after repeated operations. One boundary has to be stated before the measurements. The rewrite does not happen while the view is being painted; it happens at parsing, and at the step where the value is turned back into a string with String() and JSON.stringify. The tree only displays a result that has already been rewritten, so what this article measures is the gap between the text this page hands back to you and the text you pasted in. Every operation runs on the JSON Viewer page.

Big Integers: Already a Different Number When Parsing Ends

9007199254740993 is odd, and once it enters the tree it is shown as 9007199254740992; 9007199254740995 rounds to 9007199254740996, again settling toward an even value. Odd becomes even and the trailing digit shrinks, which means the number was pressed into a double-precision container during parsing. The one place on the whole page that keeps the original is the raw copy on the left, because it returns exactly the characters you pasted. So if you want to check whether a long integer was rewritten, compare against the left-hand raw text instead of the tree, and treat the tree as a display of what the parser accepted.

Decimals and Exponents: Normalized Into Another Face

On the decimal samples, -0 is displayed as 0 both in the tree and in the copy; the parsed value measured here is still negative zero, it only loses the sign when it is turned back into a string. Trailing zeros do not survive either: 1.0 and 1.00 become 1, 1.2300 becomes 1.23, and 1.5e3 is returned as 1500. In the other direction small values have a floor of their own: 1e-6 comes back as 0.000001, while 1e-7 stays 1e-7 untouched.

Add a few more integer digits and a clean boundary appears: the 21-digit 100000000000000000000 still shows in full decimal notation inside the tree, while one more zero, giving 22 digits, switches the display over to 1e+21.

The integer display boundary sits between 21 and 22 digits 21 digits 100000000000000000000 Full decimal notation 22 digits: add one more 0 Display becomes 1e+21 Same copy path, but the notation is swapped entirely at the moment it crosses over

Figure 2: growing the integer from 21 digits to 22 digits swaps the display notation.

Compress Writes the Rewritten Result Back Into the Input Box

This is the easiest action on the page to overlook. Clicking Compress does not open a separate output area; it writes the JSON.stringify result straight back into the input box, overwriting the text you pasted. The measured sample {"v":1.0,"w":1e21,"s":"a\\/b","d":{"a":1,"a":2}} leaves {"v":1,"w":1e+21,"s":"a/b","d":{"a":2}} sitting in the box after one click: the trailing zeros are gone, the exponential notation changed its spelling, the escaped slash merged into a single slash, and the duplicate-key source text evaporated along with them. Each rewrite on its own appeared in an earlier section; what makes this one sharp is that it clears the source text on the way out. After the overwrite nothing anywhere on the page still keeps the characters from before compression.

Whether the JSON Format page shows the same write-back behaviour is outside the scope of this measurement. There is only one thing to guard against here: anyone who treats Compress as a purely visual operation can lose the original input without ever noticing it.

Duplicate Keys and Key Order: the Tree Decides First

{"a":1,"a":2,"b":3,"b":4,"c":5} leaves only 3 rows once it enters the tree, the badge reads 3 items, and the surviving values are 2, 4, 5. A later key overwrites an earlier one, the deduplication is finished during parsing, and the badge counts the rows after deduplication rather than the keys you typed into the source string. Key order is likewise not yours to decide: eight shuffled keys {"delta":1,"2":2,"alpha":3,"10":10,"Zeta":4,"1":5,"a b":6,"x-y":7} come out in the tree order 1, 2, 10, delta, alpha, Zeta, a b, x-y. Keys that are pure integer strings move to the front in ascending numeric order, and everything else keeps its source order.

The Escape Sample: How 133 Characters Grew Into 149

Back to the sample that refused to reconcile at the beginning. An escape written as \u0041\u00df renders back into text as Aß; \ud83d\ude00 becomes the matching emoji character; \/ returns a single /. Each restored character is shorter than its escape spelling, yet the total length copied out of the whole document still rose from 133 to 149, because the rewrite happens locally, place by place, some spots shrink while others grow, and the net figure depends on the sample itself. Counting the same product again in UTF-8 gives 158 bytes. Length in itself is not something to fear, by the way: a string value of 200000 characters is displayed in full on this page, with no truncation at either end.

The pasted source string 133 characters Right-hand copy 149 characters UTF-8 count 158 bytes Escape spellings turn into real characters place by place, and length and byte count move together

Figure 1: the same escape sample, 133 characters in the source string, 149 characters in the copied product, 158 bytes under UTF-8.

State Residue: the Copy Button Remembers the Last Success

The final class is not in the text at all, it is in the order of operations. After a format succeeds, paste in an input that fails to parse: the error message is shown, and the copy button on the right still works, but what it returns is the document from the previous success rather than whatever is currently sitting in the input box. In that situation, pasting a fresh sample and copying straight away without pressing Clear is an easy way to take the wrong document. Press Clear once and the state truly returns to nothing, after which copying answers with a prompt asking you to format the JSON first. The defence against residue is plain: before you copy anything, check that the document on screen is the one that just formatted successfully.

Six Rewrites, One Comparison Table

Written in the source stringShown in the treeCopied out on the right
900719925474099390071992547409929007199254740992
-000
1.23001.231.23
1.5e315001500
1e-60.0000010.000001
A 22-digit integer (the 21-digit sample plus one more 0)1e+211e+21
\u0041\u00dfAßAß
{"s":"a\\/b"}{"s":"a/b"}{"s":"a/b"}
{"a":1,"a":2}one row a: 2{"a":2}

Q: Which step does the rewrite actually happen in?

It happens while the text is parsed into an in-memory value and then turned back into a string with String() and JSON.stringify, not while the tree is being drawn. That is why the text inside the tree and the content copied on the right agree with each other, and both disagree with the raw copy on the left.

Q: How do I confirm my own text was not rewritten?

Compare against the raw copy on the left, which keeps the characters you pasted. Anyone who takes text processed by this page back into a byte-by-byte comparison should first check whether the sample contains any of the spellings listed in the table above.

Q: Where do I look up collapsing, expanding and finding a field?

That is a separate line of measurement; the older note collapsing the tree view and locating fields by search covers it, and the six rewrites in this article do not overlap with it.

📎 Related articles

24 whitespace code points survive even with every box checked: a per-code-point truth table for text trimming 2026-11-23 A malformed URL into the parser page: example.com:80 is read as the protocol, and %e stops the segment table halfway 2026-11-21 Cron generator template button round trip: only 1 of 8 rebuilds word for word, and the previewer freezes the second on the wall clock 2026-11-21 Rejection sampling and the no-repeat cutoff: 60000 draws give chi-square 53.75, and ratio 0.05 is the switch point 2026-11-21 Is Pasted-Back SQL Byte-Identical After Formatting: 8 String Syntaxes Cross-Checked, 2 Unclosed Backticks Paired Silently 2026-11-20