この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

JSONGenerator クラス

標準 JSON 符号化方式を使用してオブジェクトを JSON コンテンツにシリアライズする場合に使用されるメソッドが含まれます。

名前空間

System

使用方法

System.JSONGenerator クラスは、標準 JSON 符号化方式のコンテンツを生成するために提供され、JSON 出力の構造をより詳細に制御できます。

JSONGenerator のメソッド

JSONGenerator のメソッドは次のとおりです。すべてインスタンスメソッドです。

close()

JSON ジェネレーターを終了します。

署名

public Void close()

戻り値

型: Void

使用方法

JSON ジェネレーターが終了すると、コンテンツを出力することはできません。

getAsString()

生成された JSON コンテンツを返します。

署名

public String getAsString()

戻り値

型: String

使用方法

このメソッドでは、JSON ジェネレーターがまだ終了していない場合は終了させます。

isClosed()

JSON ジェネレーターが終了している場合は true を返します。終了していない場合は false を返します。

署名

public Boolean isClosed()

戻り値

型: Boolean

writeBlob(blobValue)

指定された Blob 値を Base64 で符号化された文字列として出力します。

署名

public Void writeBlob(Blob blobValue)

パラメーター

blobValue
型: Blob

戻り値

型: Void

writeBlobField(fieldName, blobValue)

指定された項目名と BLOB 値を使用して、項目名と値のペアを出力します。

署名

public Void writeBlobField(String fieldName, Blob blobValue)

パラメーター

fieldName
型: String
blobValue
型: Blob

戻り値

型: Void

writeBoolean(blobValue)

指定された boolean 値を出力します。

署名

public Void writeBoolean(Boolean blobValue)

パラメーター

blobValue
型: Boolean

戻り値

型: Void

writeBooleanField(fieldName, booleanValue)

指定された項目名と boolean 値を使用して、項目名と値のペアを出力します。

署名

public Void writeBooleanField(String fieldName, Boolean booleanValue)

パラメーター

fieldName
型: String
booleanValue
型: Boolean

戻り値

型: Void

writeDate(dateValue)

指定された date 値を ISO-8601 形式で出力します。

署名

public Void writeDate(Date dateValue)

パラメーター

dateValue
型: Date

戻り値

型: Void

writeDateField(fieldName, dateValue)

指定された項目名と date 値を使用して、項目名と値のペアを出力します。date 値は、ISO-8601 形式で出力されます。

署名

public Void writeDateField(String fieldName, Date dateValue)

パラメーター

fieldName
型: String
dateValue
型: Date

戻り値

型: Void

writeDateTime(datetimeValue)

指定された datetime 値を ISO-8601 形式で出力します。

署名

public Void writeDateTime(Datetime datetimeValue)

パラメーター

datetimeValue
型: Datetime

戻り値

型: Void

writeDateTimeField(fieldName, datetimeValue)

指定された項目名と datetime 値を使用して、項目名と値のペアを出力します。datetime 値は、ISO-8601 形式で出力されます。

署名

public Void writeDateTimeField(String fieldName, Datetime datetimeValue)

パラメーター

fieldName
型: String
datetimeValue
型: Datetime

戻り値

型: Void

writeEndArray()

JSON 配列の終了マーカー (「]」) を出力します。

署名

public Void writeEndArray()

戻り値

型: Void

writeEndObject()

JSON オブジェクトの終了マーカー (「}」) を出力します。

署名

public Void writeEndObject()

戻り値

型: Void

writeFieldName(fieldName)

項目名を出力します。

署名

public Void writeFieldName(String fieldName)

パラメーター

fieldName
型: String

戻り値

型: Void

writeId(identifier)

指定された ID 値を出力します。

署名

public Void writeId(ID identifier)

パラメーター

identifier
型: ID

戻り値

型: Void

writeIdField(fieldName, identifier)

指定された項目名と ID 値を使用して、項目名と値のペアを出力します。

署名

public Void writeIdField(String fieldName, Id identifier)

パラメーター

fieldName
型: String
identifier
型: ID

戻り値

型: Void

writeNull()

JSON null リテラル値を出力します。

署名

public Void writeNull()

戻り値

型: Void

writeNullField(fieldName)

指定された項目名と JSON null リテラル値を使用して、項目名と値のペアを出力します。

署名

public Void writeNullField(String fieldName)

パラメーター

fieldName
型: String

戻り値

型: Void

writeNumber(number)

指定された小数値を出力します。

署名

public Void writeNumber(Decimal number)

パラメーター

number
型: Decimal

戻り値

型: Void

writeNumber(number)

指定された double 値を出力します。

署名

public Void writeNumber(Double number)

パラメーター

number
型: Double

戻り値

型: Void

writeNumber(number)

指定された integer 値を出力します。

署名

public Void writeNumber(Integer number)

パラメーター

number
型: Integer

戻り値

型: Void

writeNumber(number)

指定された long 値を出力します。

署名

public Void writeNumber(Long number)

パラメーター

number
型: Long

戻り値

型: Void

writeNumberField(fieldName, number)

指定された項目名と小数値を使用して、項目名と値のペアを出力します。

署名

public Void writeNumberField(String fieldName, Decimal number)

パラメーター

fieldName
型: String
number
型: Decimal

戻り値

型: Void

writeNumberField(fieldName, number)

指定された項目名と double 値を使用して、項目名と値のペアを出力します。

署名

public Void writeNumberField(String fieldName, Double number)

パラメーター

fieldName
型: String
number
型: Double

戻り値

型: Void

writeNumberField(fieldName, number)

指定された項目名と integer 値を使用して、項目名と値のペアを出力します。

署名

public Void writeNumberField(String fieldName, Integer number)

パラメーター

fieldName
型: String
number
型: Integer

戻り値

型: Void

writeNumberField(fieldName, number)

指定された項目名と long 値を使用して、項目名と値のペアを出力します。

署名

public Void writeNumberField(String fieldName, Long number)

パラメーター

fieldName
型: String
number
型: Long

戻り値

型: Void

writeObject(anyObject)

指定された Apex オブジェクトを JSON 形式で出力します。

署名

public Void writeObject(Object anyObject)

パラメーター

anyObject
型: Object

戻り値

型: Void

writeObjectField(fieldName, value)

指定された項目名と Apex オブジェクトを使用して、項目名と値のペアを出力します。

署名

public Void writeObjectField(String fieldName, Object value)

パラメーター

fieldName
型: String
value
型: Object

戻り値

型: Void

writeStartArray()

JSON 配列の開始マーカー (「[」) を出力します。

署名

public Void writeStartArray()

戻り値

型: Void

writeStartObject()

JSON オブジェクトの開始マーカー (「{」) を出力します。

署名

public Void writeStartObject()

戻り値

型: Void

writeString(stringValue)

指定された文字列値を出力します。

署名

public Void writeString(String stringValue)

パラメーター

stringValue
型: String

戻り値

型: Void

writeStringField(fieldName, stringValue)

指定された項目名と string 値を使用して、項目名と値のペアを出力します。

署名

public Void writeStringField(String fieldName, String stringValue)

パラメーター

fieldName
型: String
stringValue
型: String

戻り値

型: Void

writeTime(timeValue)

指定された time 値を ISO-8601 形式で出力します。

署名

public Void writeTime(Time timeValue)

パラメーター

timeValue
型: Time

戻り値

型: Void

writeTimeField(fieldName, timeValue)

指定された項目名と ISO-8601 形式の time 値を使用して、項目名と値のペアを出力します。

署名

public Void writeTimeField(String fieldName, Time timeValue)

パラメーター

fieldName
型: String
timeValue
型: Time

戻り値

型: Void