-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(JSONArray).toList() breaks format of entries #737
Comments
I decided to change the title, as it's late for me and i made mistake in it. According to your javadocs, this is not a desired behavior. |
@JulWas797 JSONArray.toString() will output a JSON doc, if that is what you want. We cannot change toList() due to backwards compatibility. Can you describe what you are trying to do? |
Thanks for responding! What I'm trying to basically acheive is to access elements of As |
Streams support proposed implementation: #768 |
Sir @stleary , What will be the expected result we want? I just started putting my steps in the open-source community. I will be glad if I can help :) |
@stleary |
Hi @stleary i am interested in this issue |
@Priyanshu-ai902 This project does not assign issues. Feel free to work on any issue that interests you. |
@stleary So if we can't use (for now at least) the Java 8 features we can't make the
@JulWas797 As I see, the only way to iterate the "real" data inside the JSONArray jArray = ...;
Iterable<Object> iterable = () -> jArray.iterator();
Stream<Object> stream = StreamSupport.stream(iterable.spliterator(), false); |
@ZachsCoffee It was probably not a great idea to include |
Unfortunately invoking method
.toList()
onJSONArray
Object causes entries of theJSONArray
to become malformated.Issue examples:
Output from
(JSONArray).get()
{"data":{"pressure_avg":1012.3399999999999,"humidity_avg":61.5,"temperature_avg":12.85,"pm10_avg":0.6900000000000001,"pm25_avg":0.36},"school":{"city":"DŁUGOŁĘKA","street":null,"post_code":"19-111","latitude":"53.2753471","name":"SZKOŁA PODSTAWOWA W DŁUGOŁĘCE","longitude":"22.8683732"},"timestamp":"2023-05-19 23:56:45"}
Output from
(JSONArray).toList().get()
{data={pressure_avg=1012.3399999999999, humidity_avg=61.5, temperature_avg=12.85, pm10_avg=0.6900000000000001, pm25_avg=0.36}, school={city=DŁUGOŁĘKA, street=null, post_code=19-111, latitude=53.2753471, name=SZKOŁA PODSTAWOWA W DŁUGOŁĘCE, longitude=22.8683732}, timestamp=2023-05-19 23:56:45}
The text was updated successfully, but these errors were encountered: