1
I’m trying to treat the following json:
[{"code":"ARS","codein":"BRL","name":"Peso Argentino (R$)","high":"0.165","low":"0.1638","pctChange":"0.182","open":"0","bid":"0.1643","ask":"0.1647","varBid":"0.0003","timestamp":"1522699200000","create_date":"2018-04-02 20:20:08"}]
I’m using:
JSONObject json = new JSONObject(responseBody);
JSONArray dados = json.getJSONArray("NÃO EXISTE UMA KEY?");
for (int i = 0; i < dados.length(); ++i) {
JSONObject linha = dados.getJSONObject(i);
Log.v("valor", linha.getString("high"));
}
How do I when there’s no key?
JSONArray dados = json.getJSONArray($seu_json);
was not ?– rbz
@RBZ Just a little correction, in Java is not used the $ in the name of variables.
– Piovezan
Oops ! That marked... is the addiction of PHP ! :D
– rbz
Thanks @RBZ I hadn’t tried, it worked here.
– Emerson Barcellos