Linkiden Flashcards
By convention, what name is used for the first key in a JSON schema?
$schema
Which code is the closest JSON equivalent of the data shown?
{ "color": "red", "color": "blue", "color": "green" }
Which JavaScript method converts a JavaScript value to Json?
JSON.stringify()
Which data type is NOT part of JSON standard?
date
Which term is commonly used to refer to converting data to JSON
serialization
Which code uses the correct JSON syntax to encode the key/value pair shown?
accountNum: ‘000605802’
“accountNum”: “00060504”
What character do you specify before a JSON control character when you want to use that control characters as a literal part of a string?
\
Which date type is part of the JSON standard?
Boolean
Which key name is used to specify properties that must be included for JSON to be valid?
required
Which is the valid JSON equivalent of the data shown? *** MISSING OPTIONS & “DATA SHOWN”
{ "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"], } }
How do you store several paragraphs of text as a string in JSON?
Escape all whitespaces expect space characters.
What data type is represented by the value of the key/value pair shown?
<code>loggedIn: true<code></code></code>
Boolean
If you need to store the loggedin status of a user in JSON as a boolean, what is the correct syntax?
“loggedIn”: true
What does JSON with padding (JSON-P) use to make a request?
the element
Which value is supported in the JSON specifications?
null
Which JavaScript method converts a Json to JavaScript value?
JSON.parse()
Transferring JSON information from client to server and back again often includes HTTP requests. Match each method with the best choice describing its use.
- Sends data to specific server to create or update information.
- Sends data to specific server to create or update information without the risk of creating the resource more than once.
- Previews what the GET request response might be without the body of the text.
- Learns the communication channels used by the target source.
- Requests information from a specific source.
- Removes information.
1.POST 2.PUT 3.HEADER 4.OPTIONS 5.GET 6.DELETE
Which code uses valid JSON syntax for the text “Centennial Olympics?
{ "host": "Atlanta", "year": 1996, "comments": "Centennial Olympics" }
Can trailing commas be used in objects and arrays?
no
Which whitespace characters should be escaped within a string?
new lines and carriage returns only
Which is supported by YAML but not supported by JSON?
comments
Which is an invalid JSON value?
“\s()(X 72()|/||*”
How do you encode a date in JSON?
Encode the date as string using the ISO-8601 date format.
What’s wrong with this JavaScript?
JSON.parse({“first”: “Sarah”, “last”: “Connor”}) ;
The value supplied to JSON.parse() is not a string.
What does this JavaScript code print?
printNullness(JSON.parse(‘{ “lemmings”: [] }’));
printNullness(JSON.parse(‘{ “lemmings”: null }’));
printNullness(JSON.parse(‘{ “lemmings”: “null” }’));
function printNullness(){ if (testMe.lemmings == null) console.log("null"); else console.log("not null"); }
not null null not null
What tool might you use to validate your JSON?
JSONLint
What characters denote strings in JSON?
double quotes
Which code is a valid JSON equivalent of the key/value pair shown that also preserves the data type?
“constant”: “6.022E23”
Which element is added to the DOM to create a JSON-P request?
Why do so many APIs use JSON?
Because it’s based on JavaScript.
You need to assemble a list of members, but your JSON is not parsing correctly. How do you change it?
{ “avengers”: [ “iron man”, “hulk”, “thor”, “black widow”, “ant man”, “spider man’ ] }
{ “avengers”: [ “iron man”, “hulk”, “thor”, “black widow”, “ant man”, “spider man” ] }
When building dynamic web applications using AJAX, developers originally used the ____ data format, which has since been replaced by JSON.
XML
How is a true boolean value represented in JSON?
“true”