Java Object to Json writeValueAsString(Object o)

Here you can find the source of writeValueAsString(Object o)

Description

write Value As String

License

Apache License

Declaration

public static String writeValueAsString(Object o) throws JsonProcessingException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.*;

public class Main {
    private static final ObjectMapper mapper = new ObjectMapper();

    public static String writeValueAsString(Object o) throws JsonProcessingException {
        //String t = getObojectWriter().writeValueAsString(o) ;
        String t = mapper.writeValueAsString(o);
        return t;
    }//from  www.  j a  va  2s  .  c  o  m
}

Related

  1. toJSONString(Object object, boolean camelCaseToLowerCaseWithUnderscores)
  2. toJsonString(T value)
  3. writeJSON(HashMap data)
  4. writeValueAsBytes(Object value)
  5. writeValueAsIndentString(Object value)
  6. writeValueAsString(Object obj)
  7. writeValueAsString(Object obj)