ExamGecko
Question list
Search
Search

Related questions











Question 786 - 350-401 discussion

Report
Export

Which JSON script is properly formatted?

A)

B)

C)

D)

A.

Option A

Answers
A.

Option A

B.

Option B

Answers
B.

Option B

C.

Option C

Answers
C.

Option C

D.

Option D

Answers
D.

Option D

Suggested answer: A

Explanation:

Option A is the properly formatted JSON script. JSON (JavaScript Object Notation) is a standard text-based format for representing structured data based on JavaScript object syntax. It is commonly used for transmitting data in web applications (e.g., sending some data from the server to the client, so it can be displayed on a web page, or vice versa).The JSON syntax rules are as follows12:

Data is in name/value pairs, separated by commas. A name/value pair consists of a field name (in double quotes), followed by a colon, followed by a value:'name': 'value'.

Curly braces hold objects. An object can contain multiple name/value pairs:{'name': 'value', 'name': 'value', ...}.

Square brackets hold arrays. An array can contain multiple values, separated by commas:['value', 'value', ...].

Values can be strings (in double quotes), numbers, booleans (true or false), null, objects, or arrays.

Option A follows these rules and is a valid JSON script. It defines an object with four name/value pairs:'name','age','hobbies', and'address'. The value of'name'is a string, the value of'age'is a number, the value of'hobbies'is an array of strings, and the value of'address'is another object with two name/value pairs:'city'and'country'. The object is enclosed in curly braces and the name/value pairs are separated by commas.

Option B is not a valid JSON script because it uses single quotes instead of double quotes for the field names and string values.JSON requires double quotes for strings12.

Option C is not a valid JSON script because it does not use commas to separate the name/value pairs.JSON requires commas to separate the data elements within an object or an array12.

Option D is not a valid JSON script because it uses a semicolon instead of a colon to separate the field name and the value.JSON requires a colon to separate the name and the value in a name/value pair12.Reference:1:JSON Introduction,2:JSON Syntax

asked 10/10/2024
Akhil Borkar
40 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first