public final class BJSON extends BallerinaMessageDataSource implements BRefType<JsonNode>, BCollection
BJSON represents a JSON value in Ballerina.| Modifier and Type | Class and Description |
|---|---|
static interface |
BJSON.JSONDataSource
This represents a JSON data source implementation, which should be used for custom JSON
streaming implementations.
|
| Constructor and Description |
|---|
BJSON(BJSON.JSONDataSource datasource)
Initialize a
BJSON from a streaming datasource. |
BJSON(InputStream in)
Create a
BJSON from a InputStream. |
BJSON(InputStream in,
String schema)
Create a
BJSON from a InputStream. |
BJSON(JsonNode json)
|
BJSON(String jsonString)
Initialize a
BJSON from a string, with a specified schema. |
BJSON(String jsonString,
BType type)
Initialize a
BJSON from a JSON string. |
| Modifier and Type | Method and Description |
|---|---|
BallerinaMessageDataSource |
clone() |
BValue |
copy()
Deep copy
BValue. |
String |
getMessageAsString()
Returns the entire message as string.
|
BRefType<?> |
getPrimitiveBoxedValue() |
BType |
getType() |
BIterator |
newIterator()
Create new Iterator for this collection.
|
void |
serializeData(OutputStream outputStream)
Serialize data in to a byte stream.
|
void |
setType(BType type) |
void |
setValue(JsonNode value)
Set the value associated with this
BJSON object. |
String |
stringValue() |
String |
toString()
Return the string representation of this json object.
|
JsonNode |
value()
Get value associated with this
BJSON object. |
getContentType, getDataObject, getValue, getValueAsString, getValueAsString, setContentTypepublic BJSON(JsonNode json)
json - json objectpublic BJSON(String jsonString, BType type)
BJSON from a JSON string.jsonString - A JSON stringtype - of the JSONpublic BJSON(BJSON.JSONDataSource datasource)
BJSON from a streaming datasource.datasource - Datasource of this jsonpublic BJSON(String jsonString)
BJSON from a string, with a specified schema.
JSON will not be validated against the given schema.jsonString - JSON Stringpublic BJSON(InputStream in)
BJSON from a InputStream.in - Input Streampublic BJSON(InputStream in, String schema)
BJSON from a InputStream.in - InputStream of the json contentschema - Schema of the jsonpublic String toString()
public void setValue(JsonNode value)
BJSON object.value - Value associated with this BJSON object.public void serializeData(OutputStream outputStream)
MessageDataSourceserializeData in interface MessageDataSourceserializeData in class BallerinaMessageDataSourcepublic String stringValue()
stringValue in interface BValuepublic void setType(BType type)
public String getMessageAsString()
MessageDataSourcegetMessageAsString in interface MessageDataSourcegetMessageAsString in class BallerinaMessageDataSourcepublic BallerinaMessageDataSource clone()
clone in class BallerinaMessageDataSourcepublic BIterator newIterator()
BCollectionnewIterator in interface BCollectionpublic BRefType<?> getPrimitiveBoxedValue()
Copyright © 2018 WSO2. All rights reserved.