Java Json Create createPrettyWriterFactory()

Here you can find the source of createPrettyWriterFactory()

Description

create Pretty Writer Factory

License

Apache License

Declaration

private static JsonWriterFactory createPrettyWriterFactory() 

Method Source Code

//package com.java2s;
/************************************************************************
 * Copyright (c) 2014 IoT-Solutions e.U.
 * //from w w  w  . ja  v a 2s  .  co m
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *  http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ************************************************************************/

import java.util.HashMap;

import javax.json.Json;

import javax.json.JsonWriterFactory;
import javax.json.stream.JsonGenerator;

public class Main {
    private static JsonWriterFactory createPrettyWriterFactory() {
        HashMap<String, Object> prettyConfigMap = new HashMap<String, Object>();
        prettyConfigMap.put(JsonGenerator.PRETTY_PRINTING, Boolean.TRUE);
        JsonWriterFactory prettyWriterFactory = Json.createWriterFactory(prettyConfigMap);
        return prettyWriterFactory;
    }
}

Related

  1. convertToJson(Object obj)
  2. createArrayBuilder()
  3. createArrayBuilder()
  4. createJsonFrom(JsonObject user, String... ignoreKeys)
  5. createJsonValue(String string)
  6. emptyArray()
  7. getJson(T t)
  8. object2JsonDateSerializer(Object obj, final String dateformat)
  9. toBean(Class clazz, String json)