[
'red',
'blue',
'green'
]
["red", "green", "blue"]
["red", "blue", "green"]
{
"color": "red",
"color": "blue",
"color": "green"
}
{
"red": "red",
"blue": "blue"
}
accountNum: '000605802'
/\:{{
photo: {
width: 1600,
height: 900,
binaries: {
url: 'https://www.example.com/images/34097349843',
thumbnail: 'https://www.example.com/images/thumbs/34097349843'
},
animated: false,
tags: [116, 943, 234, 38793],
}
}
{
"photo": {
"width": 1600,
"height": 900,
"binaries": {
"url": "https://www.example.com/images/34097349843",
"thumbnail": "https://www.example.com/images/thumbs/34097349843"
},
"animated": "false",
"tags": [116, 943, 234, 38793]
}
}
{
"photo": {
"width": 1600,
"height": 900,
"binaries": {
"url": "https://www.example.com/images/34097349843",
"thumbnail": "https://www.example.com/images/thumbs/34097349843"
},
"animated": false,
"tags": [116, 943, 234, 38793]
}
}
{
"photo": {
"width": 1600,
"height": 900,
"binaries": {
"url": "https://www.example.com/images/34097349843",
"thumbnail": "https://www.example.com/images/thumbs/34097349843"
},
"animated": true,
"tags": [116, 943, 234, 38793]
}
}
{
"photo": {
"width": "1600",
"height": "900",
"binaries": {
"url": "https://www.example.com/images/34097349843",
"thumbnail": "https://www.example.com/images/thumbs/34097349843"
},
"animated": "false",
"tags": ["116", "943", "234", "38793"]
}
}
loggedIn: true
<origin> element<script> element1.Sends data to specific server to create or update information.
2.Sends data to specific server to create or update information without the risk of creating the resource more than once.
3.Previews what the GET request response might be without the body of the text.
4.Learns the communication channels used by the target source.
5.Requests information from a specific source.
6.Removes information.
{
"host": "Atlanta",
"year": 1996
/_ Centennial Olympics _/
}
{
"host": "Atlanta",
"year": 1996
// Centennial Olympics
}
{
"host": "Atlanta",
"year": 1996,
"comment": "Centennial Olympics"
}
{
"host": "Atlanta",
"year": 1996,
\"Centennial Olympics\"
}
{
"host": "Atlanta",
"year": 1996,
"comment": "\"Centennial Olympics"
}
"'|=(_)(X 72(_)|\/||\*'""|=(_)(X 72(_)|\/||\*""|=(_)(X\" \"72(_)|\/||\*""\s(_)(X 72(_)|\/||\*"JSON.parse({"first": "Sarah", "last": "Connor"}) ;
printNullness(JSON.parse('{ "lemmings": [] }'));
printNullness(JSON.parse('{ "lemmings": null }'));
printNullness(JSON.parse('{ "lemmings": "null" }'));
function printNullness(testMe) {
if (testMe.lemmings == null) console.log('null');
else console.log('not null');
}
not null
null
not null
null
null
not null
not null
null
null
null
null
null
constant: 6.022E23"constant": "6.022E23""constant": "6\.022\E23""constant": 6.022E23constant: "6.022E23"Reference Explanation: Scientific Notation is a valid JSON number. You can use e or E.
<object><script><json><meta>{
"avengers": [
"iron man",
"hulk",
"thor",
"black widow",
"ant man",
"spider man'
]
}
{
"avengers": ["iron man", "hulk", "thor", "black widow", "ant man", "spider man"]
}
{
'avengers': [
{'iron man',
'hulk',
'thor',
'black widow',
'ant man',
'spider man'}
]
}
{
"avengers": ["iron man", "hulk", "thor", "black widow", "ant man", "spider man"]
}
{
"avengers": {[
"iron man",
"hulk",
"thor",
"black widow",
"ant man",
"spider man"
]}
}
[
{
"year": 2024
},
{
"location": "unknown"
}
]
\r\n
{
"result": [
{
"year": 2024
},
{
"location": "unknown"
}
]
}
{
"series": "Star Trek",
"episodes": "The Trouble with Tribbles",
"season": 3
}
"name": 'bb-8'
[]{}""()JSON.sort().*#^"variance: -0.0823
myVehicleContents = {
van: {
inside: {
'glove box': 'maps',
'passenger seat': 'crumbs',
},
exterior: {
trunk: 'jack',
},
},
};
myVehicleContents.van.inside['glove box'] = gloveBoxContents;
var gloveBoxContents = myVehicleContents.van.inside['glove box'];
gloveBoxContents;
var gloveBoxContents = myVehicleContents.van.glove box.contents;
gloveBoxContents;
myVehicleContents.van.inside['inside'] = gloveBoxContents;
| [ ] |
YAML supports # comments but not JSON
"'|=(_)(X 72(_)|\/||*'""\s(_)(X 72(_)|\/||*""|=(_)(X\" \"72(_)|\/||*""|=(_)(X 72(_)|\/||*"{"rey",'leia',"ashoka",}
['rey', 'leia', "ashoka",}['rey', 'leia', 'ashoka',}["rey", "leia", "ashoka"]{"rey", "leia", "ashoka"}{
"students": ["Tess", "Erin", "June"]
}
99999999999999999999"42"-321111.00.110011{
"name": "Jane",
"job": "developer",
"skills": ["ruby", "rails", "javascript"],
"available": false
}
{
"name": "Jane",
"job": "developer",
"skills": ["ruby", "rails", "javascript"],
"available": true,
"seeking": "part-time"
}
{
"name": "Jane",
"job": "developer",
"skills": ["ruby", "rails", "javascript"],
"available": "true",
"seeking": "part-time"
}
{
"name": "Jane",
"job": "developer",
"skills": ["ruby", "rails", "javascript"],
"available": false,
"seeking": "part-time"
}
{
"name": "Jane",
"job": "developer",
"skills": ["ruby", "rails", "javascript"],
"available": "true",
"seeking": "part-time"
}
Hint: true needs to be a boolean and part-time a string so in double quotes.
Explanation: The other options won’t work as well, as demonstrated by this StackOverflow post.
A. They are formatted to fit well on a page.
B. They shrink the report data to fit on a page.
C. They truncate the report data to fit on a single page.
D. They are both printable and shareable.
Explanation: The true statements about paginated reports are: A. They are formatted to fit well on a page. D. They are both printable and shareable. So the correct options are A and D.
Explanation: Encourage open communication within the team and involve them in problem-solving to find a solution that works best for their specific context and helps address the issue of disinterest in certain stories.
<origin> element<script> elementJSON.parse({"first": "Sarah", "last": "Connor"}) ;
{"avengers": ["iron man", "hulk", "thor", "black widow", "ant man", "spider man" ]}
{"avengers": ["iron man", "hulk", "thor", "black widow", "ant man", "spider man"]}
{'avengers': {'iron man', 'hulk', 'thor', 'black widow', 'ant man', 'spider man'}]}
{"avengers": ["iron man", "hulk", "thor", "black widow", "ant man", "spider man"]}
{"avengers": {["iron man", "hulk", "thor", "black widow", "ant man", "spider man" ]}}
Explanation:- JSON-P, or JSON with padding, serves the purpose of overcoming the same-origin policy limitation in web development. The same-origin policy restricts web pages from making AJAX requests to a different domain for security reasons. JSON-P works by wrapping JSON data in a JavaScript function call, allowing data to be retrieved from an external domain as if it were a script. This technique is commonly used for securely fetching data from external APIs, making it a valuable tool for cross-domain data exchange in web applications.
Explanation:- When you have a key in a JSON document that contains special characters, spaces, or hyphens, it is essential to enclose the key in double quotes. JSON requires keys to be represented within double quotes to ensure proper parsing and access in JavaScript. This ensures that JavaScript can correctly interpret keys with special characters or spaces and access their associated values.
{
"host": "Atlanta",
"year": 1996
/_ Centennial Olympics _/
}
{
"host": "Atlanta",
"year": 1996
// Centennial Olympics
}
{
"host": "Atlanta",
"year": 1996,
"comment": "Centennial Olympics"
}
{
"host": "Atlanta",
"year": 1996,
\"Centennial Olympics\"
}
{
"host": "Atlanta",
"year": 1996,
"comment": "\"Centennial Olympics"
}
[
{
"year": 2024
},
{
"location": "unknown"
}
]
"'|=(_)(X 72(_)|\/||\*'""|=(_)(X 72(_)|\/||\*""|=(_)(X\" \"72(_)|\/||\*""\s(_)(X 72(_)|\/||\*"[]{}null""Explanation:
An empty array in JSON is represented by square brackets with nothing inside: []. Curly braces {} represent an empty object, not an array.
[]{}null""Explanation:
An empty object in JSON is represented by curly braces with nothing inside: {}. Square brackets [] represent an empty array, not an object.
Explanation:
JSON keys can contain spaces, but like all JSON keys, they must be enclosed in double quotes. For example: {"first name": "John"} is valid JSON.
Explanation: JSON specification doesn’t define a maximum nesting depth, but practical limits exist based on parser implementations. Most parsers handle reasonable nesting (typically 100+ levels), but deeply nested structures can cause performance issues.
-423.141590xFF1.5e-10Explanation:
Hexadecimal notation like 0xFF is not valid in JSON. JSON only supports decimal numbers, including negative numbers, decimals, and scientific notation.
Explanation: JSON has no native date type. Dates are typically represented as strings (often in ISO 8601 format like “2024-01-01T00:00:00Z”) or as numbers (Unix timestamps).
Explanation: JSON Schema is a vocabulary that allows you to annotate and validate JSON documents, defining the expected structure, data types, and constraints.
mandatoryrequirednecessarymustExplanation:
The required keyword in JSON Schema specifies an array of property names that must be present in the JSON object.
$schema keyword indicate in JSON Schema?Explanation:
The $schema keyword identifies which version of the JSON Schema specification the schema is written against.
// or /* */?///* */Explanation: Standard JSON does not support comments. However, JSON5 (an extension) does support comments. For standard JSON, you can use a special key like “_comment” if you need annotations.
Explanation: JSON5 is an extension to JSON that aims to make it easier for humans to write and maintain by adding features like comments, trailing commas, unquoted keys, and more.
Explanation: JSONP (JSON with Padding) was a technique to request data from a server in a different domain, bypassing same-origin policy. It’s now largely replaced by CORS.
text/jsonapplication/jsonapplication/javascripttext/javascriptExplanation:
The official MIME type for JSON is application/json. While text/json was sometimes used historically, application/json is the standard.
Explanation:
In JSON, all keys must be strings enclosed in double quotes. Even if a key looks like a number, it must be quoted: {"123": "value"}.
JSON.parse() and eval() for parsing JSON?Explanation:
JSON.parse() is the safe way to parse JSON as it only parses JSON syntax. eval() executes any JavaScript code, making it a security risk if used with untrusted data.
JSON.stringify() do with undefined values in objects?null"undefined"Explanation:
When JSON.stringify() encounters undefined as a property value in an object, it omits that property from the output. However, undefined in arrays becomes null.
JSON.stringify() used for?Explanation: The second parameter (replacer) can be a function that transforms values or an array that specifies which properties to include in the output.
JSON.stringify() used for?Explanation: The third parameter specifies the indentation for pretty-printing. It can be a number (spaces) or a string (like “\t” for tabs).
Explanation: JSON cannot represent circular references. Attempting to stringify an object with circular references will throw a “TypeError: Converting circular structure to JSON” error.
Explanation: JSON Pointer defines a string syntax for identifying a specific value within a JSON document, like “/users/0/name” to access the name of the first user.
Explanation: JSON Patch defines a format for expressing a sequence of operations (add, remove, replace, move, copy, test) to modify a JSON document.
toJSON() method used for?Explanation:
If an object has a toJSON() method, JSON.stringify() will call it and use its return value instead of the original object.
Explanation: JSON has no native binary type. Binary data must be encoded as strings, typically using Base64 encoding.
Explanation: The JSON specification doesn’t define a maximum string length. Practical limits depend on the parser implementation and available memory.
Explanation: JSON-RPC is a stateless, light-weight remote procedure call (RPC) protocol that uses JSON to encode calls and responses.
Explanation: GeoJSON is a format for encoding a variety of geographic data structures using JSON, commonly used in mapping applications.
reviver parameter in JSON.parse()?Explanation:
The reviver parameter is a function that can transform the parsed values before they are returned, useful for converting strings to dates or other custom transformations.
Explanation: While JSON parsers typically accept duplicate keys, the behavior is undefined in the specification. Most implementations use the last value, but this should be avoided.
Explanation: BSON (Binary JSON) is a binary-encoded serialization format used by MongoDB. It extends JSON with additional data types like Date and Binary.
Explanation: MessagePack is an efficient binary serialization format that is more compact than JSON and supports additional types.
trueTrue"true"1Explanation:
JSON boolean values are lowercase: true and false. They are not strings and not capitalized.
nullNULL"null"undefinedExplanation:
The null value in JSON is lowercase: null. It is not a string and not capitalized. undefined is not a valid JSON value.
Explanation: JSON cannot represent functions. If you try to stringify an object with function properties, those properties will be omitted.
Explanation: JWT is a standard for creating access tokens that assert claims. It consists of three parts: header, payload (JSON), and signature.
Explanation: A JWT consists of three Base64-encoded parts separated by dots: Header (algorithm and type), Payload (claims), and Signature (verification).
type keyword used for?Explanation:
The type keyword in JSON Schema specifies the data type: “string”, “number”, “integer”, “boolean”, “array”, “object”, or “null”.
enum keyword in JSON Schema?Explanation:
The enum keyword restricts a value to one of a fixed set of values, like {"enum": ["red", "green", "blue"]}.
pattern keyword in JSON Schema?Explanation:
The pattern keyword specifies a regular expression that a string value must match to be valid.
minimum keyword in JSON Schema?Explanation:
The minimum keyword specifies the minimum value (inclusive) that a numeric value can have.
maxLength keyword in JSON Schema?Explanation:
The maxLength keyword specifies the maximum length (number of characters) that a string value can have.
Explanation: JSON-LD (JSON for Linking Data) is a method of encoding linked data using JSON, adding semantic meaning and context to data.
@context keyword in JSON-LD?Explanation:
The @context keyword in JSON-LD defines the context for interpreting the JSON document, mapping terms to IRIs (Internationalized Resource Identifiers).
Infinity"Infinity"Explanation:
JSON numbers cannot represent infinity or NaN. Attempting to stringify these values results in null.
""\"'""Explanation:
Double quotes inside JSON strings must be escaped with a backslash: \". For example: "He said \"Hello\"".
\r\n<br>Explanation:
Newlines in JSON strings are represented by the escape sequence \n. Literal newlines are not allowed in JSON strings.
\t\tabExplanation:
Tabs in JSON strings are represented by the escape sequence \t. Literal tabs are not allowed in JSON strings.
\\/\//Explanation:
Backslashes in JSON strings must be escaped with another backslash: \\. For example: "C:\\Users\\Name".
Explanation:
JSON supports Unicode characters either directly (if the file is UTF-8 encoded) or using \uXXXX escape sequences where XXXX is the hexadecimal code point.
additionalProperties keyword in JSON Schema?Explanation:
The additionalProperties keyword determines whether properties not explicitly defined in the schema are allowed in the JSON object.
items keyword in JSON Schema?Explanation:
The items keyword in JSON Schema defines the schema that array elements must conform to.
$ref keyword in JSON Schema?Explanation:
The $ref keyword allows you to reference another schema or a definition within the same schema, enabling schema reuse.
definitions keyword in JSON Schema?Explanation:
The definitions (or $defs in newer versions) keyword allows you to define reusable schema components that can be referenced with $ref.
allOf keyword in JSON Schema?Explanation:
The allOf keyword requires that the data validates against all of the schemas in the array, useful for combining schemas.
anyOf keyword in JSON Schema?Explanation:
The anyOf keyword requires that the data validates against at least one of the schemas in the array.
oneOf keyword in JSON Schema?Explanation:
The oneOf keyword requires that the data validates against exactly one (and only one) of the schemas in the array.
not keyword in JSON Schema?Explanation:
The not keyword requires that the data does not validate against the given schema, useful for excluding certain patterns.
Explanation: Content Security Policy is an HTTP header that helps prevent XSS attacks. It can restrict which sources can load JSON and other resources.
format keyword in JSON Schema?Explanation:
The format keyword provides semantic validation for string values, like “email”, “uri”, “date-time”, “ipv4”, etc.
Explanation: JSON Hyper-Schema extends JSON Schema to describe hypermedia APIs, including links and link relations.
Explanation: For large JSON files, streaming parsers (like SAX-style parsers) are recommended as they process the file incrementally without loading everything into memory.
null and undefined?null is a valid JSON value, undefined is notundefined is a valid JSON value, null is not$schema keyword in JSON Schema?"