Class JsonUtils
- java.lang.Object
 - 
- org.schabi.newpipe.extractor.utils.JsonUtils
 
 
- 
public final class JsonUtils extends java.lang.Object 
- 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.grack.nanojson.JsonArraygetArray(com.grack.nanojson.JsonObject object, java.lang.String path)static java.lang.BooleangetBoolean(com.grack.nanojson.JsonObject object, java.lang.String path)static com.grack.nanojson.JsonObjectgetJsonData(java.lang.String html, java.lang.String variable)Get an attribute of a web page as JSONstatic java.lang.NumbergetNumber(com.grack.nanojson.JsonObject object, java.lang.String path)static com.grack.nanojson.JsonObjectgetObject(com.grack.nanojson.JsonObject object, java.lang.String path)static java.lang.StringgetString(com.grack.nanojson.JsonObject object, java.lang.String path)static java.util.List<java.lang.String>getStringListFromJsonArray(com.grack.nanojson.JsonArray array)static java.lang.ObjectgetValue(com.grack.nanojson.JsonObject object, java.lang.String path)static java.util.List<java.lang.Object>getValues(com.grack.nanojson.JsonArray array, java.lang.String path)static com.grack.nanojson.JsonArraytoJsonArray(java.lang.String responseBody)static com.grack.nanojson.JsonObjecttoJsonObject(java.lang.String responseBody) 
 - 
 
- 
- 
Method Detail
- 
getValue
@Nonnull public static java.lang.Object getValue(@Nonnull com.grack.nanojson.JsonObject object, @Nonnull java.lang.String path) throws ParsingException- Throws:
 ParsingException
 
- 
getString
@Nonnull public static java.lang.String getString(@Nonnull com.grack.nanojson.JsonObject object, @Nonnull java.lang.String path) throws ParsingException- Throws:
 ParsingException
 
- 
getBoolean
@Nonnull public static java.lang.Boolean getBoolean(@Nonnull com.grack.nanojson.JsonObject object, @Nonnull java.lang.String path) throws ParsingException- Throws:
 ParsingException
 
- 
getNumber
@Nonnull public static java.lang.Number getNumber(@Nonnull com.grack.nanojson.JsonObject object, @Nonnull java.lang.String path) throws ParsingException- Throws:
 ParsingException
 
- 
getObject
@Nonnull public static com.grack.nanojson.JsonObject getObject(@Nonnull com.grack.nanojson.JsonObject object, @Nonnull java.lang.String path) throws ParsingException- Throws:
 ParsingException
 
- 
getArray
@Nonnull public static com.grack.nanojson.JsonArray getArray(@Nonnull com.grack.nanojson.JsonObject object, @Nonnull java.lang.String path) throws ParsingException- Throws:
 ParsingException
 
- 
getValues
@Nonnull public static java.util.List<java.lang.Object> getValues(@Nonnull com.grack.nanojson.JsonArray array, @Nonnull java.lang.String path) throws ParsingException- Throws:
 ParsingException
 
- 
toJsonArray
public static com.grack.nanojson.JsonArray toJsonArray(java.lang.String responseBody) throws ParsingException- Throws:
 ParsingException
 
- 
toJsonObject
public static com.grack.nanojson.JsonObject toJsonObject(java.lang.String responseBody) throws ParsingException- Throws:
 ParsingException
 
- 
getJsonData
public static com.grack.nanojson.JsonObject getJsonData(java.lang.String html, java.lang.String variable) throws com.grack.nanojson.JsonParserException, java.lang.ArrayIndexOutOfBoundsExceptionGet an attribute of a web page as JSON
Originally a part of bandcampDirect.
Example HTML:
<p data-town="{"name":"Mycenae","country":"Greece"}"> This is Sparta!</p>Calling this function to get the attribute
data-townreturns the JsonObject for{ "name": "Mycenae", "country": "Greece" }- Parameters:
 html- The HTML where the JSON we're looking for is stored inside a variable inside some JavaScript blockvariable- Name of the variable- Returns:
 - The JsonObject stored in the variable with this name
 - Throws:
 com.grack.nanojson.JsonParserExceptionjava.lang.ArrayIndexOutOfBoundsException
 
- 
getStringListFromJsonArray
public static java.util.List<java.lang.String> getStringListFromJsonArray(@Nonnull com.grack.nanojson.JsonArray array) 
 - 
 
 -