# Problem with returned json

**URL:** <https://community.tempest.earth/t/problem-with-returned-json/26909>\
**Category:** Developers\
**Tags:** tempest\
**Created:** [March 24, 2025, 11:34pm UTC](https://community.tempest.earth/t/problem-with-returned-json/26909 "2025-03-24T23:34:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rudynickmann](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rudynickmann](https://community.tempest.earth/u/rudynickmann)\
**Post date:** [March 24, 2025, 11:34pm UTC](https://community.tempest.earth/t/problem-with-returned-json/26909/1 "2025-03-24T23:34:03Z")

</div>

I’m starting a project using JAVA. When I use… [https://swd.weatherflow.com/swd/rest/observations/device/{device\_id}](https://swd.weatherflow.com/swd/rest/observations/device/%7Bdevice_id%7D)  
the returned json has double starting and ending array brackets in the ‘obs’ object… []. When I try to parse this json I always get an error message. Is there an issue here? I’ve come up with a clumsy hack using string functions to overcome this and replace the double brackets with single brackets but I wonder if there is a problem with the request response on Tempest’s end.

---

<div class="post-metadata">

**Author:** ![bandl](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@bandl](https://community.tempest.earth/u/bandl)\
**Post date:** [March 25, 2025, 4:18am UTC](https://community.tempest.earth/t/problem-with-returned-json/26909/2 "2025-03-25T04:18:09Z")

</div>

It would likely be helpful to include the request and the verbatim response you are getting in order to troubleshoot this.

---

<div class="post-metadata">

**Author:** ![cmorello](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/cmorello/32/9967_2.png) [@cmorello](https://community.tempest.earth/u/cmorello)\
**Post date:** [March 25, 2025, 3:05pm UTC](https://community.tempest.earth/t/problem-with-returned-json/26909/3 "2025-03-25T15:05:38Z")

</div>

Double brackets is just an array of arrays so you would parse it as such.

---

<div class="post-metadata">

**Author:** ![rudynickmann](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rudynickmann](https://community.tempest.earth/u/rudynickmann)\
**Post date:** [March 25, 2025, 4:10pm UTC](https://community.tempest.earth/t/problem-with-returned-json/26909/4 "2025-03-25T16:10:24Z")

</div>

Thanks for responding..,  
This is my HttpRequest…

```auto
HttpRequest request = HttpRequest.newBuilder()
        .uri(URI.create("[https://swd.weatherflow.com/swd/rest/stats/station/](https://swd.weatherflow.com/swd/rest/stats/station/)" + my_station_id + "?api_key=" + my_access_key))
        .header("accept", "application/json")
        .method("GET", HttpRequest.BodyPublishers.noBody())
        .build();
HttpResponse<String> response = null;
try {
    response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
} catch (IOException e) {
    e.printStackTrace();
} catch (InterruptedException e) {
    e.printStackTrace();
}

```

```auto
-------------------------------------------------------------------

```

```auto
This is the response...

```

```auto
{"status":{"status_code":0,"status_message":"SUCCESS"},"device_id":378803,"type":"obs_st","summary":{"pressure_trend":"steady","strike_count_1h":0,"strike_count_3h":0,"precip_total_1h":0.0,"strike_last_dist":42,"strike_last_epoch":1735705542,"precip_accum_local_yesterday":12.033536,"precip_accum_local_yesterday_final":6.787493,"precip_analysis_type_yesterday":1,"feels_like":9.4,"heat_index":9.4,"wind_chill":9.4},"obs":[[1742911151,0.4,1.2,1.9,324,6,1008.5,9.4,49,34161,1.51,285,0.0,0,0,0,2.61,1,0.0,0.0,0.0,0]]}

```

```auto
Note the double array brackets... I wasn't able to parse this json until I altered this string to

```

```auto
replace the double brackets with single brackets. I'm not a professional developer... maybe I just don't understand json well enough.

```

```auto
Thanks,

```

```auto
Rudy

```

```auto

```

```auto

```

```auto

```

```auto

```

---

<div class="post-metadata">

**Author:** ![bandl](https://avatars.discourse-cdn.com/v4/letter/b/4491bb/32.png) [@bandl](https://community.tempest.earth/u/bandl)\
**Post date:** [March 25, 2025, 5:24pm UTC](https://community.tempest.earth/t/problem-with-returned-json/26909/5 "2025-03-25T17:24:28Z")

</div>

You may want to check the JSON parser you are using - that response is indeed valid. You can paste it into something like [https://jsonlint.com](https://jsonlint.com) or [https://jsonchecker.com/](https://jsonchecker.com/) to confirm as well.

If you’d like, perhaps post the code setting up the parser you’re using along with how you’re setting any configuration options? The problem may be there-

---

<div class="post-metadata">

**Author:** ![vreihen](https://sea2.discourse-cdn.com/flex020/user_avatar/community.tempest.earth/vreihen/32/13217_2.png) [@vreihen](https://community.tempest.earth/u/vreihen)\
**Post date:** [March 25, 2025, 9:04pm UTC](https://community.tempest.earth/t/problem-with-returned-json/26909/6 "2025-03-25T21:04:15Z")

</div>

> [@rudynickmann](#):
>
> Note the double array brackets… I wasn’t able to parse this json until I altered this string to replace the double brackets with single brackets. I’m not a professional developer… maybe I just don’t understand json well enough.

The problem that you are encountering is that the original API was written to return an array of arrays for obs values to allow for observation catch-ups in one request if there was a backlog. I added spaces below to make an example more readable:

`[[obs_array0] [obs_array1] [obs_array2] ]`

Proper programming would iterate the returned obs array and process each sub-array, but I honestly don’t recall ever seeing more than one sub-array returned at least in the UDP API that uses the same format.

I don’t know JAVA, but something like obs[0] would be the Python way of getting the first sub-array without having to go to a string and delete the outside array [] characters…
