Description
Saves the JSON data to the local file.
Applies to
JSONGenerator objects
Syntax
objectname.SaveToFile ( FileName )
|
Argument |
Description |
|---|---|
|
objectname |
The name of the JSONGenerator object whose data you want to save to the file. |
|
FileName |
A string whose value is the file full name. |
Return value
Integer.
Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is null, the method returns null.
Examples
JsonGenerator lnv_JsonGenerator
lnv_JsonGenerator = Create JsonGenerator
// Create an object root item
Long 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.AddItemBoolean(ll_RootObject, "boolean", true)
lnv_JsonGenerator.AddItemDateTime(ll_RootObject, "datetime", datetime("2017-09-21 12:00:00"))
lnv_JsonGenerator.AddItemBlob(ll_RootObject, "blob", blob("this is blob"))
lnv_JsonGenerator.AddItemNull(ll_RootObject, "remark")
// Get the JSON dadta
lnv_JsonGenerator.SaveToFile("d:\test.json")
// The generated JDSON is
{
"string": "string",
"long": 100,
"boolean": true,
"datetime": "2017-09-21 12:00:00",
"blob": "dABoAGkAcwAgAGkAcwAgAGIAbABvAGIA",
"remark": null
}


