java - json Can not deserialize value of type byte from String -


in spring java application, receiving rest json request following input 'mode' field defined byte in java class.

{   "application": "sadsd",   "date": "20161109",   "mode": "a",   "catalogid": 0, } 

pojo -

public class test {   string application;   string date;   byte mode;   int catalogid; ... } 

getting following error -

"exception": org.springframework.http.converter.httpmessagenotreadableexception",   "message": "could not read document: can not deserialize value of type byte string \"a\": not valid byte value\n @  [source: java.io.pushbackinputstream@6386b197; line: xx, column: xx]  (through reference chain: com.abc.myinput[\"mode\"]);   `enter code here`nested exception com.fasterxml.jackson.databind.exc.invalidformatexception: can not deserialize value of type byte string \"a\":  not valid byte value\n @ [source: java.io.pushbackinputstream@6386b197; line: xx, column: xx]  (through reference chain: com.abc.myinput[\"mode\"])",` 

do have write serializer , deserializer here?
are there annotations can use on byte field or get/set methods of field without writing additional code?

i went ahead declaring them string , taking first byte input string , converting byte string output.
thanks input cricket_007 , jnbbender.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -