Class JsonValue
- java.lang.Object
-
- com.microsoft.cognitiveservices.speech.util.JsonValue
-
- All Implemented Interfaces:
AutoCloseable
public class JsonValue extends Object implements AutoCloseable
The type Json value.
-
-
Constructor Summary
Constructors Constructor Description JsonValue(int item, SafeHandle handle)Instantiates a new Json value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanasBoolean()As boolean.floatasFloat()As float.longasInt()As int.StringasJson()As json string.StringasString()As string.voidclose()Closeintcount()Count int.JsonValueget(int index)Get json value.JsonValueget(String key)Get json value.StringgetName(int index)Get the name of the value.booleanhasValue(int index)Has value.booleanhasValue(String key)Has value.static JsonValueParse(String json)Parse json value.
-
-
-
Constructor Detail
-
JsonValue
public JsonValue(int item, SafeHandle handle)Instantiates a new Json value.- Parameters:
item- the itemhandle- the handle
-
-
Method Detail
-
Parse
public static JsonValue Parse(String json)
Parse json value.- Parameters:
json- the json string- Returns:
- the json value
-
asString
public String asString()
As string.- Returns:
- the string value
-
asInt
public long asInt()
As int.- Returns:
- the long value
-
asFloat
public float asFloat()
As float.- Returns:
- the float value
-
asBoolean
public boolean asBoolean()
As boolean.- Returns:
- the boolean value
-
asJson
public String asJson()
As json string.- Returns:
- the json string value
-
get
public JsonValue get(String key)
Get json value.- Parameters:
key- the key- Returns:
- the json value
-
get
public JsonValue get(int index)
Get json value.- Parameters:
index- the index- Returns:
- the json value
-
getName
public String getName(int index)
Get the name of the value.- Parameters:
index- The index to get the name of.- Returns:
- String representing the name of the value if any.
-
hasValue
public boolean hasValue(int index)
Has value.- Parameters:
index- the index- Returns:
- the boolean value
-
hasValue
public boolean hasValue(String key)
Has value.- Parameters:
key- the key- Returns:
- the boolean value
-
count
public int count()
Count int.- Returns:
- the int
-
close
public void close() throws ExceptionClose- Specified by:
closein interfaceAutoCloseable- Throws:
Exception- will throw if private handle.close fails.
-
-