Home  >  Article  >  Java  >  How to solve the problem that json format is incorrect

How to solve the problem that json format is incorrect

coldplay.xixi
coldplay.xixiOriginal
2020-08-11 14:18:078772browse

Solution to incorrect json format: 1. Open [Format] and remove the [Encode in utf-8 without BOM format] option; 2. Remove the BOM header directly in the java code.

How to solve the problem that json format is incorrect

Solution to incorrect json format:

Method 1: Remove the utf8 BOM format, this is Because we use utf-8 encoding when writing json files, and the utf8 BOM format is incompatible with the json format, we only need to remove the utf8 BOM format.

How to solve the problem that json format is incorrect

Method 2: We can remove the BOM header directly in the java code. When writing code, you can simply remove the BOM header in the code.

How to solve the problem that json format is incorrect

Related learning recommendations: java basic tutorial

The above is the detailed content of How to solve the problem that json format is incorrect. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn