Description
Gets the JSON blob data. The returned blob data is encoded with EncodingUTF16LE! by default.
Applies to
Syntax
objectname.GetJsonBlob ( {Encoding e} )
Argument |
Description |
---|---|
objectname |
The name of the JSONGenerator or JSONPackage object whose data you want to obtain. |
e (optional) |
Character encoding of the resulting blob. Values are: EncodingANSI!, EncodingUTF8!, EncodingUTF16LE! (default), and EncodingUTF16BE!. |
Return value
Blob.
Returns the JSON blob data if it succeeds and empty string ("") if an error occurs. If any argument's value is null, the method returns null.
Examples
This example gets the JSON blob data.
blob lblb_Json Long ll_RootObject JsonGenerator lnv_JsonGenerator lnv_JsonGenerator = Create JsonGenerator // Create an object root item ll_RootObject = lnv_JsonGenerator.CreateJsonObject() // Add a value child item lnv_JsonGenerator.AddItemString(ll_RootObject, "string", "string") lnv_JsonGenerator.AddItemNumber(ll_RootObject, "long", 100) lnv_JsonGenerator.AddItemDateTime(ll_RootObject, "datetime", datetime("2017-09-21 12:00:00")) // Gets the JSON data lblb_Json = lnv_JsonGenerator.GetJsonBlob()
This example packages the data of DataWindow, DataStore and DataWindowChild object and assigns the value to a blob.
blob lblb_json datastore lds_employee datawindowchild ldwc_active JsonPackage lnv_package lnv_package = create JsonPackage ...//Initialize data for lds_employee, ldwc_active // package the data lnv_package.SetValue("d_department", dw_department, false) lnv_package.SetValue("d_employee", lds_employee) lnv_package.SetValue("dddw_active", ldwc_active, false) lblb_json = lnv_package.GetJsonBlob()
See also