Here you can find the source of decode(String s)
Parameter | Description |
---|---|
s | String <p> |
public static JsonStructure decode(String s)
//package com.java2s; //License from project: Apache License import java.io.StringReader; import java.util.Objects; import javax.json.Json; import javax.json.JsonReader; import javax.json.JsonStructure; public class Main { /**/* w ww .j ava 2 s . c om*/ * Obtain a {@link JsonStructure} from a String. * <p> * @param s String * <p> * @return JsonStructure */ public static JsonStructure decode(String s) { if (s == null || s.isEmpty()) { return null; } final StringReader r = new StringReader(Objects.requireNonNull(s)); try (JsonReader jr = Json.createReader(r)) { return jr.read(); } } }