我应该使用哪种数据结构来存储数千个对象的JSONArray? [英] Which data structure should I use to store a JSONArray of thousand Objects?

查看:286
本文介绍了我应该使用哪种数据结构来存储数千个对象的JSONArray?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个JSON响应,它有一个JSONArray(数据),它有一千个对象,每个对象有8个键/值对的值。



这是我的JSON回复



http://pastebin.com/qJraV4ka



我想将响应存储在Java数据结构中,我想将这些记录插入到SQLite数据库中。

I还想获取存储在数据结构中的记录的第一个和最后一个对象,然后我想获得该对象的属性。

哪种数据结构最适合上述场景并给出一些建议用另一种方式做到这一点。

解决方案

请参阅我对这个问题的评论。你的问题不太清楚。例如,您可以使用此开源库: https://github.com/google/gson [ ^ ]。



< DD> -SA

I have a JSON Response that has a JSONArray ("data"), it has thousand objects, and each object has 8 Key/Value pair’s values.

Here is my JSON Response

http://pastebin.com/qJraV4ka

I want to store the response in the Java Data Structure from where I want to insert these records in to the SQLite Database.
I also want get the first and last object of the record that is stored in the data structure, then I want to get the properties of that object.
Which Data Structure is best for the above mentioned scenario and give some suggestion to do this with another way.

解决方案

Please see my comment to the question. Your problem is not quite clear. You can use, for example, this open-source library: https://github.com/google/gson[^].

—SA


这篇关于我应该使用哪种数据结构来存储数千个对象的JSONArray?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆