Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collapse the body object. #301

Closed
OhYee opened this issue Dec 10, 2018 · 7 comments
Closed

Collapse the body object. #301

OhYee opened this issue Dec 10, 2018 · 7 comments

Comments

@OhYee
Copy link

OhYee commented Dec 10, 2018

The REST client will format the json like this:

tim 20181210140707

which I can not fold the key1 entirly.

And what I want is like
tim 20181210140716

When the first array is too long, it's hard to see the second array quickly

@Huachao
Copy link
Owner

Huachao commented Dec 10, 2018

@OhYee thanks for your suggestion

@OhYee
Copy link
Author

OhYee commented Dec 10, 2018

This the what return in Django

{
    "key1": [{"id": 1}, {"id": 2}, {"id": 3}, {"id": 4}, {"id": 5}],
    "key2": [{"id": 1}, {"id": 2}, {"id": 3}, {"id": 4}, {"id": 5}],
    "key3": [{"id": 1}, {"id": 2}, {"id": 3}, {"id": 4}, {"id": 5}],
}

And this is what restclient get

HTTP/1.1 200 OK
Date: Mon, 10 Dec 2018 07:22:35 GMT
Server: WSGIServer/0.2 CPython/3.7.1
Content-Type: application/json
Vary: Origin, Cookie
X-Frame-Options: SAMEORIGIN
Content-Length: 195

{
  "key1": [{
    "id": 1
  }, {
    "id": 2
  }, {
    "id": 3
  }, {
    "id": 4
  }, {
    "id": 5
  }],
  "key2": [{
    "id": 1
  }, {
    "id": 2
  }, {
    "id": 3
  }, {
    "id": 4
  }, {
    "id": 5
  }],
  "key3": [{
    "id": 1
  }, {
    "id": 2
  }, {
    "id": 3
  }, {
    "id": 4
  }, {
    "id": 5
  }]
}

Because the first line is "key1": [{, so I can not fold the key1.
It will fold { "id": 1 }, instead of key1: [...]

Maybe add a \n between [ and { will help.

@OhYee
Copy link
Author

OhYee commented Dec 10, 2018

大概用中文交流能方便点……
意思就是因为这里"key1": [{,所以在折叠的时候会优先折叠后面的{这就导致如果key1是一个很长的数组,我想看到key2,只有两种选择:

  1. 靠运气拖动滚动条找到key2
  2. 一个一个折叠key1对应的列表里的内容

如果可以直接折叠key1,如'key1;:[...]),就可以解决这个问题了

@Huachao

@Huachao
Copy link
Owner

Huachao commented Dec 10, 2018

@OhYee this seems related to issue of the json beautify library, see issue here beautifier/js-beautify#1402

@Huachao
Copy link
Owner

Huachao commented Dec 25, 2018

@OhYee I have implemented this JSON prettify logic on my own instead of 3rd party library. It will be published in next release.

@Huachao Huachao closed this as completed Dec 25, 2018
@Huachao
Copy link
Owner

Huachao commented Jan 3, 2019

@OhYee you can try the latest version 0.21.0 to verify the fix

@OhYee
Copy link
Author

OhYee commented Jan 3, 2019

@Huachao
Good job 👍
Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants