Java ClassLoader readSampleJson(String name)

Here you can find the source of readSampleJson(String name)

Description

read Sample Json

License

Open Source License

Declaration

static JsonNode readSampleJson(String name) 

Method Source Code


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

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.net.URL;

public class Main {
    static JsonNode readSampleJson(String name) {
        URL jsonUrl = Thread.currentThread().getContextClassLoader().getResource(name);
        ObjectMapper mapper = new ObjectMapper();
        try {//from www  .  j  a v a2  s.c  o  m
            return mapper.readValue(jsonUrl, JsonNode.class);
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
    }
}

Related

  1. loadTextFile(final String location)
  2. loadXml()
  3. locateFile(String name)
  4. read(String fileName)
  5. readFromFile(Object obj, String fileName)
  6. saveProperties(Properties properties, String name)
  7. scanPackage(String path)
  8. searchByAttributeKey(String key)
  9. storePropertiesFile(String fileName, String filePath, String storeComment)