建议json-format选项对于console和http api能够分开设置
- Dominant language
- Java
- Stars
- 37.5k
- Forks
- 7.6k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 4
Description
3.6.5 开始 http api和console的行为一致了,可以通过 options json-format 进行控制。这可以避免一些问题,但是有时候http api就是希望是结构化的数据,如果设置了 options json-format true,又会导致console 调用的时候的一些报错:
```
[arthas@52097]$ vmtool --action getInstances --className org.springframework.web.servlet.FrameworkServlet
ERROR DATA!!! object class: class [Lorg.springframework.web.servlet.FrameworkServlet;, exception class: class java.lang.StackOverflowError, exception message: null
[arthas@52097]$
[arthas@52097]$ options json-format false
NAME BEFORE-VALUE AFTER-VALUE
----------------------------------------
json-format true false
[arthas@52097]$ vmtool --action getInstances --className org.springframework.web.servlet.FrameworkServlet
@FrameworkServlet[][
@DispatcherServlet[org.springframework.web.servlet.DispatcherServlet@1b440f31],
@DispatcherServlet[org.springframework.web.servlet.DispatcherServlet@4b887328],
]
```
所以建议http api是否可以加入一个参数直接设置此次返回的结果是不是使用json格式,而不作为一个全局选项。
Contributor guide
Research direction
Start by tracing how the existing json-format option is handled at the HTTP API and console entry points, using the vmtool behavior shown in the report. Done means an HTTP API request can choose JSON output for that response without requiring the global option or causing the console behavior to change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100