JSONItem.DecimalFormat

From Xojo Documentation

Property (As String )
aJSONItem.DecimalFormat = newStringValue
or
StringValue = aJSONItem.DecimalFormat

New in 2011r2

Supported for all project types and targets.

Sets the format of numbers when converting to a JSON String. See the Format command for more info.

Notes

Keep in mind that the JSON spec does not support some of the characters that are valid in Format. These include, the thousands character, %, ( ), \.

To format values your are fetching from JSON, use the Format method.

Example

This example specifies a format with two places after the decimal.

Var Person As New JSONItem
person.DecimalFormat = "######.##"

// This object is manipulated like a dictionary
person.Value("Name") = "John Doe"
person.Value("Age") = 32
person.Value("Married") = True
person.Value("Spouse") = "Jane Doe"
person.Value("Salary") = 54212.46512

Var s As String = Person.ToString
// s = {"Name":"John Doe","Age":32,"Married":true,"Spouse":"Jane Doe","Salary":54212.47}