| 100 | |
| 101 | // Tries to parse the data |
| 102 | private void parseData() { |
| 103 | final String warningsValue = "warnings"; |
| 104 | this.parsed = false; |
| 105 | this.body = readBody(); |
| 106 | this.result = parseJson(); |
| 107 | this.parsed = this.result != null; |
| 108 | if (parsed && result.has("data")) { |
| 109 | if (result.get("data").isJsonArray()) { |
| 110 | this.data = result.get("data").getAsJsonArray(); |
| 111 | } |
| 112 | if (result.get("data").isJsonObject()) { |
| 113 | this.data = result.get("data").getAsJsonObject(); |
| 114 | } |
| 115 | } |
| 116 | if (parsed && result.has(warningsValue)) { |
| 117 | if (result.get(warningsValue).isJsonArray()) { |
| 118 | this.warnings = result.get(warningsValue).getAsJsonArray(); |
| 119 | } |
| 120 | if (result.get(warningsValue).isJsonObject()) { |
| 121 | this.warnings = result.get(warningsValue).getAsJsonObject(); |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | // Tries to read the body. |
| 127 | private String readBody() { |