Promotic
WikipediaLinkedInYoutubeTwitterFacebook

JsonStringify - method of object Pm

Description:
From input value creates text in JSON format
Syntax:
JsonStringify(Value As Variant, [Space As String]) As String
Calling:
var sJson = Pm.JsonStringify(Value, )
Parameters:
Value(Variant) Input value that is transformed into JSON format. The value can be:
- object of the PmMap type
- array of the PmArray type
- elementary data type (Integer, String, Boolean, Double ...)
Space[optional] (String) Adds return values of JSON offset to the text, space and end-row characters for easier reading.
If space is omitted (or the semicolon is right after colon) then the text condensed without additional spaces (everything on single row without offset of levels of embedding).
If space is number (1 to 10) then the text of return value has offset of defined number of spaces on each level.
If space is non-empty string e.g. tab (space:\t;) or two spaces then the text of return value has offset by characters defined in string on each level.
If space is longer than 10 characters then only the first ten characters will be used.
Note:
The value transformation procedure into JSON text is following:
- Number is transformed into text, the decimal separator is period.
- Boolean is transformed into text as true or false.
- String is transformed into text and inserted into quotation marks. If there is a quotation mark character in the string then it is transformed to two characters \".
- PmMap object: Is transformed into the form of JSON object. For example {"propery1":value1,"property2":value2}.
- PmArray object: Is transformed into the form of JSON array. For example [value1,value2].
- If the value type is other than those listed above then the method fails and returns Empty.
 
The method can also be called in the graphic item events for Web Panels.
Example:
Creates object PmMap, fills it with properties name and Val and saves this object into the string in JSON format.
Dim sJson, oMap
oMap.mapSetValueAt "name", "Temperature"
oMap.mapSetValueAt "val", 65.5
sJson2 = Pm.JsonStringify(oMap)
In variable sJson there will be string: {"name":"Temperature","val":65.5}.
Navigation:
 
- Pm
 
- Abs
- Cos
- E
- Exp
- JsonStringify
 
 
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice