GetJsonBlob
PowerScript function
Description
Gets the JSON blob data. The returned blob data is encoded with
EncodingUTF16LE! by default.
Applies to
Syntax
|
1 |
objectname.GetJsonBlob ( {Encoding e} ) |
|
Argument |
Description |
|---|---|
|
objectname |
The name of the JSONGenerator or JSONPackage object whose |
|
e (optional) |
Character encoding of the resulting blob. Values are: EncodingANSI!, EncodingUTF8!, EncodingUTF16LE! |
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.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
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.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest