내가 GSON 잭슨과 안드로이드에서 11메가바이트에 대해 큰 JSON을 구문 분석의 문제에 직면하고있다. 문제는 메모리 부족 오류 예외가 발생하고 힙 크기가이 프로세스를 수행하는 데 충분하지 않다는 것입니다. 이것은 나의 종이 모델 클래스입니다
public class Paper {
public int primaryKey;
public String title;
public int entry;
public Boolean favourite;
public String comment;
public int opt;
public int score;
}
이 내 응답 모델 클래스
public class Response {
public List<Paper> papers;
}
이 내가 실수를 한 곳에 내 JSON 문자열
{"Paper":[[{"abstract":"Not Available","title":"A Fully Intraocular 0.0169mm<sup>2<\/sup>/pixel 512-Channel Self-Calibrating Epiretinal Prosthesis in 65nm CMOS","primaryKey":3,"entry":9,"score":-1,"comment":null,"favourite":false,"opt":1},{"abstract":"Not Available","title":"A Scalable 2.9mW 1Mb/s eTextiles Body Area Network Transceiver with Remotely Powered Sensors and Bi-Directional Data Communication","primaryKey":14,"entry":9,"score":-1,"comment":null,"favourite":false,"opt":1},{"abstract":"Not Available","title":"A 0.18µm CMOS SoC for a 100m-Range 10fps 200×96-Pixel Time-of-Flight Depth Sensor","primaryKey":20,"entry":9,"score":-1,"comment":null,"favourite":false,"opt":1},{"abstract":"Not Available","title":"A 12b 1.6GS/s 40mW DAC in 40nm CMOS with >70dB SFDR over Entire Nyquist Bandwidth","primaryKey":26,"entry":9,"score":-1,"comment":null,"favourite":false,"opt":1},{"abstract":"Not Available","title":"All-Digital Hybrid Temperature Sensor Network for Dense Thermal Monitoring","primaryKey":49,"entry":9,"score":-1,"comment":null,"favourite":false,"opt":1},{"abstract":"Not Available","title":"32Gb/s Data-Interpolator Receiver with 2-Tap DFE in 28nm CMOS","primaryKey":51,"entry":9,"score":-1,"comment":null,"favourite":false,"opt":1},{"abstract":"Not Available","title":"A 93% Efficiency Reconfigurable Switched-Capacitor DC-DC Converter Using On-Chip Ferroelectric Capacitors","primaryKey":60,"entry":9,"score":-1,"comment":null,"favourite":false,"opt":1},{"abstract":"Not Available","title":"A 45nm CMOS Near-Field Communication Radio with 0.15A/m RX Sensitivity and 4mA Current Consumption in Card Emulation Mode","primaryKey":61,"entry":9,"score":-1,"comment":null,"favourite":false,"opt":1}]]}
나도 몰라입니다. 서류가 많으면 널 null이됩니다.
안드로이드에서 11 MB의 JSON? 그것은 상당히 높습니다. 당신은 왜 많은 양의 JSON을 파싱하려고합니까? –
@Pradeep이 어플은 오프라인 지원 애플리케이션입니다. 우리는 한 번 다운로드하고 해당 파일을 구문 분석합니다. – Praveen
'Paper'와'papers'는 동일하지 않습니다. 자바 부분에서'papers'를'Paper'로 바꾸거나 JSON에서'Paper'를'papers'로 바꾼다면 더 잘 될 가능성이 큽니다. – Alex