Reputation: 15
I'm trying to parse some huge JSON file (like link ) using volley library. How can i load and add to RecyclerView. would like to know what is the best approch to parse this kind of big file (about 80k lines) and if you may know good API that can help me processing this.
help me ..-> Thanks.
Upvotes: 0
Views: 1958
Reputation: 1087
You should use Flatbuffer library :
- website : https://google.github.io/flatbuffers/
- talk 1 : https://www.youtube.com/watch?v=iQTxMkSJ1dQ
- talk 2 : https://www.youtube.com/watch?v=90ND0yQVYg8
My advice : By experience, Flatbuffer implementation can be complicated, so if your data can be static, use AssetManager to persist your huge JSON File in local application, and load it for use it.
Upvotes: 0
Reputation: 2575
You can use Gson just create pojo of this json for example with Pojo generator and then just pass json to gson. examples
Upvotes: 2
Reputation:
You should use json streaming either with gson
or jackson
. With Jackson
you can use a hybrid approach
as well. This would reduce your memory consumption significantly as only the portion of json being parsed is loaded into memory
.
https://sites.google.com/site/gson/gson-user-guide
A jackson example http://www.mkyong.com/java/jackson-streaming-api-to-read-and-write-json/
Upvotes: 1