Using the JSON Validator
The JSON Validator checks that the text you paste is JSON and reports the top-level type. The JSON field starts at {"a":1}. Choose Validate JSON. The label above the headline reads Result. The headline is Valid JSON. The sentence says the JSON is valid. The top-level type is object. The Type line is object. The Characters line is 7, which is the length of {"a":1} after trimming. The page does not fetch a URL.
The text is decoded with a depth limit of 30. A successful decode reports object, array, string, number, true, false, or null. {"a":1} decodes as an object, so the Type line is object and the headline stays Valid JSON. The steps under the result say to decode the text, stop at depth 30, and report the top-level type. The headline is Valid JSON for every successful type. The type itself is on the Type line, not in the headline. Read the Type line before you treat Valid JSON as a claim that the top-level type is object. For this sample it is object. For a different paste it can be another type.
An empty field, or a field that is only spaces, is rejected with Enter JSON. Text longer than 200000 characters is rejected with Enter JSON of 200000 characters or fewer. Text that does not decode, including text deeper than the depth limit, is rejected with Enter valid JSON. {a:1} uses that message because the key is not a JSON string. Spaces around {"a":1} are trimmed, so the Characters line stays 7 and the type stays object. The page does not minify JSON. It does not rewrite the field.
Copy result copies the sentence. For the sample it copies The JSON is valid. The top-level type is object. It does not copy the JSON field. Reset returns the field to {"a":1}. The headline returns to Enter JSON. The label stays Result, which is also the label on a successful run. The sentence and the lines are cleared. Copy the sentence before you reset. Validate the sample twice and the headline stays Valid JSON. The page does not fetch a URL.
What the Headline Valid JSON Measures
The headline says the text decoded. It does not name the type. For {"a":1} the type is object, and that word is on the Type line and in the sentence. The Characters line is 7. The seven characters are the opening brace, the quote, the letter a, the quote, the colon, the digit 1, and the closing brace. Valid JSON is the headline for this object and for every other successful type. If you quote the headline alone, say the text decoded, and keep the Type line with it. The label above the headline reads Result.
How {"a":1} Becomes Valid JSON
The page trims the JSON field, checks that something remains, checks that the length is at most 200000 characters, and decodes the text with a depth limit of 30. {"a":1} passes each of those checks. The decoded value is an object, so the Type line is object and the sentence names object. The Characters line uses the length after trimming. Spaces before or after {"a":1} do not raise the 7. A space inside the text would count, because trim does not remove it. The page does not minify JSON, so it also does not remove a space you put inside the text. The page does not fetch a URL.
Interest on a principal is a different product. The Simple Interest Calculator multiplies principal by an annual percent and by years. A principal of 1000 at 5 percent for 2 years earns interest of 100 and a total of 1100. The headline there is the interest. That page does not decode JSON. Use it when the sample principal of 1000 should earn interest of 100. Use this page when {"a":1} should return Valid JSON and the type object.
What the JSON Field Does Not Assume
The page does not know what the object means. The key a and the number 1 are not looked up. The sentence says the JSON is valid and names the top-level type. It does not repeat the key. The Characters line is 7 for the sample, which tells you the length, not the meaning of a. If you need the text itself in a note, copy it from the field. Copy result copies the sentence, not the field. The page does not fetch a URL.
From {"a":1} to Valid JSON
Leave the JSON field at {"a":1}. Choose Validate JSON. The headline is Valid JSON. The label reads Result. The Type line is object. The Characters line is 7. The sentence says the JSON is valid. The top-level type is object. Validate again. The figures match. Put spaces before and after the same text. The Characters line is still 7, because the page trims, and the type is still object. Replace the field with [1]. The headline is Valid JSON. The Type line is array. The Characters line is 3. The sentence says the JSON is valid. The top-level type is array. Restore {"a":1} and confirm the type is object and the Characters line is 7.
A compounded amount is a different figure. The Compound Interest Calculator compounds a principal at an annual percent. A principal of 1000 at 5 percent, compounded 1 times a year for 1 years, is 1050. The interest line there is 50. The headline there is the amount. That page does not decode JSON. Use it when the sample principal of 1000 should become 1050. Use this page when {"a":1} should return Valid JSON and the type object.
Pastes People Treat as the Wrong Type
A common miss is to read the headline Valid JSON as the type. The type for the sample is object, on the Type line and in the sentence. The label reads Result. Another miss is to read 7 as the number inside the object. 1 is the number in {"a":1}. 7 is the character count of the whole text. Another miss is to drop the quotes around the key and type {a:1}. That paste is rejected with Enter valid JSON. Another miss is to treat [1] as an object. The Type line is array and the Characters line is 3.
A comparison that does not pick a base is a different percent. The Percentage Difference Calculator uses the absolute difference divided by the average of the absolute values, times 100. The absolute difference of 40 and 50 is 10. The average of the absolute values is 45. The percentage difference is 22.22. That page does not decode JSON. Use it when you are comparing two numbers. Use this page when {"a":1} should return Valid JSON and the type object.
Keeping the JSON, the Type, and the Length
Copy the sentence. For the sample it says the JSON is valid and the top-level type is object. It does not include {"a":1} and it does not include the Characters line of 7. A note that says only Valid JSON can be this object, the array [1], or the JSON true. The sentence narrows that to the type, and you still need the text from the field if the note must show which object decoded. Write {"a":1} and 7 beside the sentence. Copy the sentence before you reset. Reset returns the field to {"a":1} and the headline to Enter JSON. The lines are cleared. The label stays Result.
A margin from revenue and cost is a different percent. The Profit Margin Calculator subtracts cost from revenue and divides that profit by revenue. Revenue of 200 and cost of 150 give profit of 50 and a margin of 25 percent. The headline there is the margin percent. That page does not decode JSON. Use it when the inputs are revenue and cost and the sample margin is 25 percent. Use this page when the record you need is {"a":1}, the type object, and 7 characters.
A Type for the JSON You Pasted
The headline answers whether the text decoded. From {"a":1} the answer is Valid JSON, the type is object, and the length is 7. From [1] the answer is Valid JSON, the type is array, and the length is 3. From true the type is true. From 1 the type is number. From null the type is null. From a quoted string the type is string. From an empty field the headline is Enter JSON. From {a:1} the headline is Enter valid JSON. The page does not fetch a URL. The page does not minify JSON.
Checking the Type and the Character Count
Count the characters in {"a":1} yourself. Opening brace, quote, a, quote, colon, 1, closing brace is 7. Compare 7 with the Characters line. The decoded value has one key, so the type is object. Compare object with the Type line and with the sentence. If the Characters line is not 7, the field is not the sample, even when the headline still says Valid JSON. Spaces wrapped around the sample do not change the 7. A different object can still be valid and show another length.
A sale price after one discount percent is a different reduction. The Discount Calculator multiplies a price by one percent and subtracts. A price of 80 at 25 percent is a discount of 20 and a sale price of 60. The headline there is the sale price. That page does not decode JSON. Use it when the sample price of 80 at 25 percent should return a sale price of 60. Use this page when {"a":1} should return Valid JSON and the type object.