我想将String @JsonProperty批注转换为List <String> @JsonProperty

时间:2019-11-25 08:41:58

标签: java json jackson jackson-databind

以前,属性描述类似于

class UserCreateListTest(APITestCase):
    def setUp(self):
        self.client = Client()


    def test_create_user(self):
        url = reverse('users:create_user')
        user = {'first_name':'first','last_name':'last','username':'username','email':'email@email.com',
                'password1':'1234@password.com','password2':'1234@password.com',
                "profile": {
            "user": 1,
            "address": "add",
            "contact": "cc"
        },
               }
        response = self.client.post(url,data=user,format='json')
        print(response.status_code)
        print(response.json())
        return self.assertEqual(response.status_code,status.HTTP_201_CREATED)

现在我将相同的代码转换为

@JsonProperty("order_field")
  private String order_field         = null;
  @JsonProperty("order_by")
  private String order_by            = null;

//getters and setters

但它不接受以前的API功能的这种新行为

您能帮我寻找其他领域吗?

提前感谢您的帮助!

0 个答案:

没有答案