Annotation Type JsonString


  • @Target(FIELD)
    @Retention(RUNTIME)
    public @interface JsonString
    Use this annotation to specify that a declared numeric Java field should map to a JSON string.

    By default declared Java numeric fields are stored as JSON numbers. For example:

     
     class A {
     @Key BigInteger value;
     }
     
     

    can be used for this JSON content:

     
     {"value" : 12345768901234576890123457689012345768901234576890}
     
     

    However, if instead the JSON content uses a JSON String to store the value, one needs to use the JsonString annotation. For example:

     
     class B {
     @Key @JsonString BigInteger value;
     }
     
     

    can be used for this JSON content:

     
     {"value" : "12345768901234576890123457689012345768901234576890"}
     
     
    Since:
    1.3