1Z0-900 · Question #23
Which class do you use to handle an incoming JSON Message as a stream?
The correct answer is A. JsonReader. JsonReader is the correct choice because it reads an incoming JSON message from a character or byte stream (via InputStream or Reader) and deserializes it into a JSON structure - making it the go-to class when receiving and consuming a JSON payload from a stream source…
Question
Which class do you use to handle an incoming JSON Message as a stream?
Options
- AJsonReader
- BJsonObjectBuilder
- CJsonParser
- DJsonObject
How the community answered
(38 responses)- A87% (33)
- B5% (2)
- C8% (3)
Explanation
JsonReader is the correct choice because it reads an incoming JSON message from a character or byte stream (via InputStream or Reader) and deserializes it into a JSON structure - making it the go-to class when receiving and consuming a JSON payload from a stream source.
JsonParser (C) is a common trap: it does process JSON in a streaming, event-driven fashion (pull-parser style), but it operates at a lower level, emitting parse events rather than directly reading an incoming message as a whole. JsonObjectBuilder (B) is for constructing a JsonObject programmatically, not reading one. JsonObject (D) is simply the resulting data structure - it holds parsed JSON data but has no stream-handling capability of its own.
Memory tip: Think of JsonReader like a BufferedReader for JSON - it reads from a stream and hands you back the parsed object. The name literally contains "Reader," which maps directly to "reading a stream."
Topics
Community Discussion
No community discussion yet for this question.