Java Object to Json writeValueAsIndentString(Object value)

Here you can find the source of writeValueAsIndentString(Object value)

Description

write Value As Indent String

License

MIT License

Declaration

public static String writeValueAsIndentString(Object value) throws JsonProcessingException 

Method Source Code

//package com.java2s;
/*******************************************************************************
*  Copyright ? 2012-2015 eBay Software Foundation
*  This program is dual licensed under the MIT and Apache 2.0 licenses.
*  Please see LICENSE for more information.
*******************************************************************************/

import com.fasterxml.jackson.core.JsonProcessingException;

import com.fasterxml.jackson.databind.ObjectMapper;

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

    public static String writeValueAsIndentString(Object value) throws JsonProcessingException {
        return indentMapper.writeValueAsString(value);
    }//from w  ww . j a  v  a2 s . c om

    public static String writeValueAsString(Object value) throws JsonProcessingException {
        return mapper.writeValueAsString(value);
    }
}

Related

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