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

SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON #859

Open
yibird opened this issue Nov 14, 2024 · 3 comments
Open

SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON #859

yibird opened this issue Nov 14, 2024 · 3 comments

Comments

@yibird
Copy link

yibird commented Nov 14, 2024

用的com.github.xiaoymin:knife4j-openapi3-jakarta-spring-boot-starter 4.5.0版本。 看了issue 我在WebConfig类添加了

private final Jackson2ObjectMapperBuilder jacksonBuilder;
@OverRide
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
converters.add(new ByteArrayHttpMessageConverter());
converters.add(new MappingJackson2HttpMessageConverter(jacksonBuilder.build()));
}

但是访问 knife4j页面还是出现 SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON 。一开始我以为是转换器的顺序问题,但是调整了顺序还是出无效的JSON

@xiaoymin
Copy link
Owner

@yibird
Copy link
Author

yibird commented Nov 15, 2024

我加了没用 大佬能麻烦看一下吗? 另外 /v3/api-docs 返回的数据 Apifox 也是能导入的

@ttkOfCode
Copy link

@yibird 题主你好,我也是这个问题,现在你的问题的解决了吗,spring boot用的3.3.5,knife4j-openapi3-jakarta-spring-boot-starter用的4.5.0

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

No branches or pull requests

3 participants