From the course: JSON Processing with Java EE
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Find the value of a JSON key
From the course: JSON Processing with Java EE
Solution: Find the value of a JSON key
(light, inquisitive music) - [Instructor] So, how did you get on with your first streaming model challenge? Here's how I solved it. As you can see, all I do is to create a parser by passing it the JSON data I want to search, and iterate over the events generated by the parser. I filter on the key_name event, test the key_name against the key provided, and only return a value if it is a string or a number. Otherwise, I return null. A more sophisticated example might also return arrays and objects as strings, but I'll leave that up to you to do.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Introduction to the streaming model2m 43s
-
(Locked)
Parse JSON data6m 47s
-
(Locked)
Write JSON data2m 3s
-
(Locked)
Challenge: Find the value of a JSON key34s
-
(Locked)
Solution: Find the value of a JSON key32s
-
(Locked)
Challenge: Output JSON object to a file22s
-
(Locked)
Solution: Output JSON object to file13s
-
(Locked)
-