Xbasic
a5_json_prep Function
Syntax
a5_JSON_Prep(object as P)
Arguments
- objectPointer
A property object from which null values will be removed.
Description
Removes null values from a property object.
Discussion
Used before calling VarToJSON() to remove property values that are nulls. Takes an array of JSON objects and populates an Xbasic property array.
Example
dim object as p
object.var1 = ""
object.var2 = null_value()
object.var3 = 0
object.var4 = "foo"
object.var5 = [1,2,3,4]
' Remove null properties - var1 and var2 - from object:
a5_JSON_prep(object)
dim json as c = varToJSON(object)
? json
= {
var3: 0,
var4: 'foo',
var5: [
1,
2,
3,
4
]
}See Also