title: JSON Parsing Exception: Failed to decode VALUE_STRING as base64 (MIME-NO-LINEFEEDS): Illegal character '"' (code 0x22) in base64 content
body: <p>Using Jackson and I'm trying to encode data in JSON &amp; it's giving Exception.</p>
  
  <p>I tried String data &amp; byte[] data:</p>
  
  <pre><code>String representation of same data is here:
  Bytes converted to String--------&gt;&gt;
  {
   "appname": "aaa",
   "deviceType": "diehdcj",
   "reportedDate": "2015-05-03T15:38:45+00:00",
   "sessionId": "5366372183482-6736-23562378",
   "deviceId": "2151272389",
   "commandName" : "wqgduwusdue",
   "protocolVersion" : "0.1",
   "protocolName" : "whjs_ashk_ask",
   "data" : "false"
  }
  </code></pre>
  
  <p><strong>Java</strong></p>
  
  <blockquote>
    <p>16:50:46.065 [] [] ERROR AAATSHConnector [http-apr-10.40.120.85-80-exec-3] - JSON Parsing Exception: Failed to decode VALUE_STRING as base64 (MIME-NO-LINEFEEDS): Illegal character '"' (code 0x22) in base64 content</p>
  </blockquote>
  
  <p>Here's the code that does the parsing:</p>
  
  <p><strong>Java</strong></p>
  
  <pre><code>@Consumes(MediaType.APPLICATION_JSON)
  @Produces(MediaType.APPLICATION_JSON)
  public Response retrieveDevicePassword(InputStream request, @Context HttpServletRequest servletRequest) throws BadRequestException, ValidationException, UnknownServerException
  {
      ObjectMapper objectMapper = new ObjectMapper();
      DemoRequest req = null;
      DemoRequest res = null;
      byte[] data = null;
      data= IOUtils.toByteArray(request);
      DemoRequest = objectMapper.readValue(data, DemoRequest.class); //It's where the Exception occurs
  </code></pre>
  
  <p><strong>Java</strong></p>
  
  <pre><code>//Snippet of POJO
  @XmlRootElement(name = "demoRequest") 
  @JsonInclude(Include.NON_EMPTY) 
  public class DemoRequest { 
  
  private String commandName;
  
  private String sessionId;
  
  private byte[] data;
  
  //getters &amp; setters 
  
  }
  </code></pre>
  
  <p>Amazingly when I try to convert same String or byte[] with a little change in the actual content "data" : "true" , it works.</p>
  
  <p>Can anyone please help</p>
  
  <p>Found the solution, but don't know what's it exactly doing:
  If I place an escape character in front of false, like "data" : "\false" , 
  it works fine.</p>
  
  <p>What could be the explanation for that?</p>