You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何移除API JSON响应中的方括号[]?(已解决:该问题此前迭代已修复,系误分配)

Hey folks, let's clear this up right away!

Background & Original Requirement

The original task was to adjust an API response that returned JSON in this format:

{"authorities": [{"authority": "Employee"}]}

The goal was to remove the square brackets ([]) from the response, converting the array structure into a single object output.

The related code setup includes:

  • A Spring MVC endpoint mapped to /autho that returns a ResponseEntity<GetAuthorityResponse>
  • The usr.getAuthorities() method (from Spring Security) returns a Collection<GrantedAuthority>
  • GetAuthorityResponse converts that collection to a Collection<CustomAuthority>, where CustomAuthority is an enum annotated with @JsonFormat(shape=JsonFormat.Shape.OBJECT)
Important Update
  • This issue has already been fixed in a previous iteration
  • This task was assigned by mistake, no further development or adjustments are needed here.

内容的提问来源于stack exchange,提问作者Adil

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.01 01:02:44