[FEATURE] 能否给一个大批量读取 100mb json格式的demo
- Dominant language
- Java
- Stars
- 4.4k
- Forks
- 613
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 6
Description
一直报错
JSONReader reader = new JSONReader(new InputStreamReader(getAssets().open("goods.json"),
"UTF-8"));
reader.startArray();//开始解析json数组
while (reader.hasNext()) {
reader.startObject();//开始解析json对象
Good good = new Good();
while (reader.hasNext()) {
String key = reader.readString();
if ("id".equals(key)) {
good.setId(reader.readString());
} else if ("name".equals(key)) {
good.setName(reader.readString());
} else if ("price".equals(key)) {
good.setPrice(Double.parseDouble(reader.readString()));
} else if ("barCode".equals(key)) {
good.setBarCode(reader.readString());
} else if ("desc".equals(key)) {
good.setDesc(reader.readString());
} else if ("count".equals(key)) {
good.setCount(Integer.parseInt(reader.readString()));
} else {
reader.readObject();//读取对象
}
}
reader.endObject();//结束解析对象
}
reader.endArray();//结束解析数组
reader.close();关闭流
reader = null;
Contributor guide
Research direction
Start with the JSONReader usage shown in the issue and the goods.json asset, reproducing the reported failure with the 100 MB JSON array. Check the Android asset-loading and streaming parsing entry points; done means a working large-file demo that reads the array without the reported error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- data, mobile-dev
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100