[GH-ISSUE #805] support response json array #281

Closed
opened 2026-03-16 14:21:05 +03:00 by kerem · 3 comments
Owner

Originally created by @ChaceYang on GitHub (Apr 23, 2020).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/805

Describe the bug

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'response'
  2. If response is JSON array
  3. See error

Expected behavior
support JSON array

Desktop (please complete the following information):

  • OS: OSX10.15.4
  • Browser: Chrome81.0.4044.113
Originally created by @ChaceYang on GitHub (Apr 23, 2020). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/805 **Describe the bug** ![](https://i.imgur.com/dN126Sg.png) **To Reproduce** Steps to reproduce the behavior: 1. Go to 'response' 2. If response is JSON array 3. See error **Expected behavior** support JSON array **Desktop (please complete the following information):** - OS: OSX10.15.4 - Browser: Chrome81.0.4044.113
kerem 2026-03-16 14:21:05 +03:00
  • closed this issue
  • added the
    feature
    label
Author
Owner

@liyasthomas commented on GitHub (Apr 23, 2020):

Please use the issue template for god's sake.
Can you at least provide a test endpoint so that we could replicate issue at our end.

<!-- gh-comment-id:618429099 --> @liyasthomas commented on GitHub (Apr 23, 2020): Please use the issue template for god's sake. Can you at least provide a test endpoint so that we could replicate issue at our end.
Author
Owner

@ChaceYang commented on GitHub (Apr 23, 2020):

sorry about that.

To Reproduce
Steps to reproduce the behavior:

  1. import this curl:
curl -X GET "https://my-json-server.typicode.com/typicode/demo/posts" -H "accept: application/json"
  1. Go to 'response'
  2. See error
<!-- gh-comment-id:618460799 --> @ChaceYang commented on GitHub (Apr 23, 2020): sorry about that. To Reproduce Steps to reproduce the behavior: 1. import this curl: ``` curl -X GET "https://my-json-server.typicode.com/typicode/demo/posts" -H "accept: application/json" ``` 2. Go to 'response' 3. See error
Author
Owner

@shtakai commented on GitHub (Apr 26, 2020):

Hello. 🍣

The type it seems {} as Object by this.response.body.constructor.name.
But in this case, it seems [] as Array by this.response.body.constructor.name.

I tried changing lang on Editor component's prop.Modify responseType by Object(json) or Array(json5)

  • json => displays error x.
  • json5 => displays no errors.

So I modified by using json5 when the response body is Array.
(json when is is Object)

Screenshot from 2020-04-26 13-30-24
Screenshot from 2020-04-26 13-30-51

I'll make PR later.
Modify responseType by Object(json) or Array(json5) by shtakai · Pull Request #813 · liyasthomas/postwoman

Thank you.

<!-- gh-comment-id:619480304 --> @shtakai commented on GitHub (Apr 26, 2020): Hello. :sushi: The type it seems `{}` as `Object` by `this.response.body.constructor.name`. But in this case, it seems `[]` as `Array` by `this.response.body.constructor.name`. I tried changing `lang` on Editor component's prop.Modify responseType by Object(json) or Array(json5) - `json` => displays error `x`. - `json5` => displays no errors. So I modified by using `json5` when the response body is `Array`. (`json` when is is `Object`) ![Screenshot from 2020-04-26 13-30-24](https://user-images.githubusercontent.com/2187465/80297878-3c1a8e80-87c2-11ea-8100-7f7854d8012b.png) ![Screenshot from 2020-04-26 13-30-51](https://user-images.githubusercontent.com/2187465/80297882-4472c980-87c2-11ea-9228-d081eebc732b.png) I'll make PR later. [Modify responseType by Object(json) or Array(json5) by shtakai · Pull Request #813 · liyasthomas/postwoman](https://github.com/liyasthomas/postwoman/pull/813) Thank you.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#281
No description provided.