Java Object to Json toJson(Object o)

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

Description

to Json

License

Open Source License

Declaration

public static final String toJson(Object o) throws Exception 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import com.fasterxml.jackson.databind.ObjectMapper;;

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

    public static final String toJson(Object o) throws Exception {
        return JSON_MAPPER.writeValueAsString(o);
    }// ww  w.  j  a  v a2s .c  o m
}

Related

  1. objToJson(Object obj)
  2. toJson(List list)
  3. toJson(Object dto)
  4. toJson(Object message)
  5. toJson(Object o)
  6. toJSON(Object obj)
  7. toJSON(Object obj)
  8. toJson(Object obj)
  9. toJson(Object object)