Java InputStream Deserialize to Object deserialize(String input, Class tClass)

Here you can find the source of deserialize(String input, Class tClass)

Description

Returns JSON encoded string as real object

License

Apache License

Parameter

Parameter Description
input the encoded JSON string

Return

Returns PoJo

Declaration

public static <T> T deserialize(String input, Class<T> tClass) throws IOException 

Method Source Code

//package com.java2s;
/*// w  ww  . ja v a2s .  co  m
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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 com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;

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

    /**
     * Returns JSON encoded string as real object
     *
     * @param input the encoded JSON string
     * @return Returns PoJo
     */
    public static <T> T deserialize(String input, Class<T> tClass) throws IOException {
        return OBJECT_MAPPER.readValue(input, tClass);
    }
}

Related

  1. deserialize(InputStream inputStream)
  2. deserialize(InputStream is)
  3. deserialize(InputStream is)
  4. deserialize(InputStream sourceInputStream, Class objectType)
  5. deserialize(ObjectInputStream stream)
  6. deserializeFromStram(InputStream inputStram)
  7. deserializeFromStream(ObjectInputStream in)
  8. deserializeInt(InputStream in)
  9. deserializeSpecial(InputStream is, Class clazz)