Forums Register Login

Accessing JSON property names

+Pie Number of slices to send: Send
I'm working on a way to parse JSON files and collect their contents for use elsewhere. I currently have a working example that is as follows:



I'm using the json.simple library.

Here's a sample string from the parsed file.



What my question is about is how to take this code, and have the put method be able to assign to the corresponding Map dynamically. This is what I currently have:



The ??? part is where I'm stumped. Getting the values of the current JSON line is easy enough. But how to get the property eludes me. Is there a method that I can call on this object that I'm not familiar with? A different and better way to itenerate through this? Or am I doing this completely assbackwards right from the get go?
+Pie Number of slices to send: Send
Check out JSONObject#keys() and JSONObject#names()
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1146 times.
Similar Threads
Reading Nested Json in Java
Error parsing JSON request string
NPE when wrapping a Reader in a BufferedReader twice
Parsing a JSON string
Searching google images from java code
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 05:57:00.