[SpringBoot] 85. In SpringBoot, Boolean type data transfers to 0/1 and returns serialization configuration

In SpringBoot, the front-end passes parameters 0,1, and the back-end can be automatically parsed into a boolean type, but when the back-end returns the front-end boolean type, it cannot be automatically converted to 0,1, so we need to customize the serialization configuration, and the boolean type converted to 0,1

1. Type correspondence

  • The boolean type has
false,true
  • corresponding int type
0,1

2. Serialization configuration

import com.fasterxml.jackson.core.JsonGenera

Guess you like

Origin blog.csdn.net/qq_40065776/article/details/132017826