logo

Deserializes JSON String into Java object using JSON.parseObject() with Fastjson

Java Code Examples for com.alibaba.fastjson.JSON.parseObject()

This method to deserializes the JSON string into a Java object.

package simplesolution.dev;

import com.alibaba.fastjson.JSON;

import java.util.List;
import java.util.Map;

public class JSONParseObjectExamples {

    public static void main(String... args) {
        String data = "[{\"name\":\"Sample JSON Serialization\",\"url\":\"https://simplesolution.dev\"},{\"name\":\"Java Tutorials\",\"url\":\"https://simplesolution.dev/java\"}]";
        List<Map<String, String>> objectFromJsonString = JSON.parseObject(data, List.class);
        System.out.println("Object from String: " + objectFromJsonString);

    }
}

Happy Coding 😊

Tags: