Example usage for org.springframework.boot.json JsonParserFactory getJsonParser

List of usage examples for org.springframework.boot.json JsonParserFactory getJsonParser

Introduction

In this page you can find the example usage for org.springframework.boot.json JsonParserFactory getJsonParser.

Prototype

public static JsonParser getJsonParser() 

Source Link

Document

Static factory for the "best" JSON parser available on the classpath.

Usage

From source file:org.springframework.boot.env.SpringApplicationJsonEnvironmentPostProcessor.java

private void processJson(ConfigurableEnvironment environment, String json) {
    try {//  w  w  w  . j a v  a  2 s.  c  o  m
        JsonParser parser = JsonParserFactory.getJsonParser();
        Map<String, Object> map = parser.parseMap(json);
        if (!map.isEmpty()) {
            addJsonPropertySource(environment, new MapPropertySource("spring.application.json", flatten(map)));
        }
    } catch (Exception ex) {
        logger.warn("Cannot parse JSON for spring.application.json: " + json, ex);
    }
}