nerdexam
Cisco

350-401 · Question #1081

Drag and Drop Question Drag and drop the code snippets from the bottom onto the blanks in the script to convert a Python object into a compact JSON object by removing space characters. Not all options

The correct answer is json_encode; $inputArray; $encodedJSON. The correct arrangement uses json_encode as the function to convert a PHP object/array into a JSON string, $inputArray as the source data being encoded, and $encodedJSON as the variable storing the resulting compact JSON output. To remove space characters and produce compact JSON

Submitted by stefanr· Mar 6, 2026Server-Side Scripting and Data Interchange - understanding how to serialize PHP data structures into JSON format using built-in encoding functions, commonly tested in PHP development and web application certifications (e.g., Zend PHP, CompTIA Web Developer).

Question

Drag and Drop Question Drag and drop the code snippets from the bottom onto the blanks in the script to convert a Python object into a compact JSON object by removing space characters. Not all options are used. Answer:

Exhibits

350-401 question #1081 exhibit 1
350-401 question #1081 exhibit 2

Answer Area

Drag items

$encodedJSON$inputArrayjson_encodejson_decode

Correct arrangement

  • json_encode
  • $inputArray
  • $encodedJSON

Explanation

The correct arrangement uses json_encode as the function to convert a PHP object/array into a JSON string, $inputArray as the source data being encoded, and $encodedJSON as the variable storing the resulting compact JSON output. To remove space characters and produce compact JSON, json_encode($inputArray, JSON_UNESCAPED_SLASHES) or similar flags are used, with the result assigned to $encodedJSON. This follows the standard PHP pattern: $encodedJSON = json_encode($inputArray, JSON_PRETTY_PRINT ^ JSON_PRETTY_PRINT) or with JSON_UNESCAPED_UNICODE to strip whitespace.

Topics

#JSON encoding#PHP functions#data serialization#string manipulation

Community Discussion

No community discussion yet for this question.

Full 350-401 Practice