Namespace: Consultingwerk.Util
Class 
JsonHelper Copy to Clipboard
Parent classes:
Inherits: Progress.Lang.Object

File:JsonHelper
Purpose:Helper class for handling Json Objects
Author(s):Mike Fechner / Consultingwerk
Created:Wed May 18 17:29:44 CEST 2016
Purpose: Protected default constructor
Notes: Disallow instance creation



Top Method Summary
Options Name Purpose
+ Consultingwerk.JsonDataTypeEnum AblDataTypeToJsonDataTypeEnum (character) Returns the JSON Type for the given ABL Data Type
+ AddBufferFields (handle, JsonObject, character) Adds the given fields of a buffer to an JSON Object
+ AddBufferFields (handle, JsonObject, character, logical) Adds the given fields of a buffer to an JSON Object
+ AddBufferFields (handle, JsonObject, character, logical, logical) Adds the given fields of a buffer to an JSON Object
+ Progress.Json.ObjectModel.JsonArray AddNewJsonArray (JsonObject, character) Adds a new JsonArray to the given JsonObject
+ Progress.Json.ObjectModel.JsonObject AddNewJsonObject (JsonArray) Adds a new JsonObject to the given JsonArray
+ Progress.Json.ObjectModel.JsonObject AddNewJsonObject (JsonObject, character) Adds a new JsonObject to the given JsonObject
+ AddObjectPropertiesToJson (Object, JsonObject, character) Adds the properties of the given ABL Object to the JSON Object
+ AddObjectPropertiesToJsonArray (Object, JsonArray, character, character, character) Adds the properties of the given ABL Object to the JSON Array as name/value pairs
+ AddObjectPropertiesToJsonArray (Object, JsonArray, character, character, character, character) Adds the properties of the given ABL Object to the JSON Array as name/value pairs
+ AddSetPropertyValue (JsonObject, character, character) Adds or sets a property to a JsonObject
+ AddWidgetPropertiesToJsonArray (handle, JsonArray, character, character, character) Adds the properties of the given widget to the JSON Array as name/value pairs
+ AssignBufferFieldFromJson (handle, JsonObject) Assigns fields of the buffer from the values of the JSON object
+ AssignBufferFromJson (handle, JsonObject, character, character) Assigns fields of the buffer from the values of the JSON object
+ AssignJsonObjectPropertiesFromString (JsonObject, character) Assigns properties in the given JsonObject from a Character value
+ CHARACTER AttributeValueList (JsonArray, character) Builds a Character list of the property values in all objects of the array
+ CHARACTER AttributeValueList (JsonArray, character, character) Builds a Character list of the property values in all objects of the array
+ Progress.Json.ObjectModel.JsonObject CharacterDictionaryToJsonObject (CharacterDictionary) Returns a JsonObject populated from a CharacterDictionary
+ CopyProperties (JsonObject, JsonObject, character) Copies the given JSON Properties from the source JSON to the target JSON
+ EnsureCharacterProperty (JsonObject, character) Ensures that a primitive JSON property is a character
+ CHARACTER ExactPropertyName (JsonObject, character) Returns the property name if found in the JSON object in the exact case as it appears in the JSON object
+ Progress.Json.ObjectModel.JsonConstruct FindJsonConstruct (JsonConstruct, character) Recursively searches the passed in JsonObject for an JsonObject or JsonArray (JsonConstruct) under a property with the given name
+ Progress.Json.ObjectModel.JsonObject FindJsonObjectWithArrayValue (JsonArray, character, integer) Locates the JsonObject from a JsonArray with the requested integer value in a JsonArray property
+ Progress.Json.ObjectModel.JsonObject FindJsonObjectWithPropertyValue (JsonArray, character, character) Locates the JsonObject from a JsonArray with the requested character property value
+ Progress.Json.ObjectModel.JsonObject FindJsonObjectWithPropertyValue (JsonArray, character, integer) Locates the JsonObject from a JsonArray with the requested integer property value
+ Progress.Json.ObjectModel.JsonObject FromDataset (handle) Returns the JSON Object with the contents of the given ProDataset
+ Progress.Json.ObjectModel.JsonObject FromDataset (handle, logical) Returns the JSON Object with the contents of the given ProDataset
+ Progress.Json.ObjectModel.JsonObject FromTempTable (handle) Returns the JSON Object with the contents of the given Temp-Table
+ CHARACTER GetCharacterByPath (JsonObject, character) Returns the Character Value specified by the given path
+ CHARACTER GetCharacterByPath (JsonObject, character, ArrayBaseEnum) Returns the Character Value specified by the given path
+ INTEGER GetIntegerByPath (JsonObject, character) Returns the Integer Value specified by the given path
+ INTEGER GetIntegerByPath (JsonObject, character, ArrayBaseEnum) Returns the Integer Value specified by the given path
+ Progress.Json.ObjectModel.JsonArray GetJsonArrayByPath (JsonObject, character) Returns the Json Array represented by a path in the source Json Object
+ Progress.Json.ObjectModel.JsonArray GetJsonArrayByPath (JsonObject, character, ArrayBaseEnum) Returns the Json Array represented by a path in the source Json Object
+ Progress.Json.ObjectModel.JsonObject GetJsonObjectByPath (JsonObject, character) Returns the Json Object represented by a path in the source Json Object
+ Progress.Json.ObjectModel.JsonObject GetJsonObjectByPath (JsonObject, character, ArrayBaseEnum) Returns the Json Object represented by a path in the source Json Object
+ LOGICAL GetLogicalByPath (JsonObject, character) Returns the Logical Value specified by the given path
+ LOGICAL GetLogicalByPath (JsonObject, character, ArrayBaseEnum) Returns the Logical Value specified by the given path
# GetObjectAndPropertyName (JsonObject, character, ArrayBaseEnum, JsonObject, character) Returns the JSON object that is referenced by the path and the Property name
+ LOGICAL IsInt64Property (JsonArray, integer) Returns if the given property is an Int64 value
+ LOGICAL IsInt64Property (JsonObject, character) Returns if the given property is an Int64 value
+ LOGICAL IsIntegerProperty (JsonArray, integer) Returns if the given property is an Integer value
+ LOGICAL IsIntegerProperty (JsonObject, character) Returns if the given property is an Integer value
+ CHARACTER JsonArrayToCharacterExtent (JsonArray) Converts a JsonArray into the Character Extent
+ DATE JsonArrayToDateExtent (JsonArray) Converts a JsonArray into the Date Extent
+ DATETIME JsonArrayToDateTimeExtent (JsonArray) Converts a JsonArray into the DateTime Extent
+ DATETIME-TZ JsonArrayToDateTimeTzExtent (JsonArray) Converts a JsonArray into the DateTime-TZ Extent
+ DECIMAL JsonArrayToDecimalExtent (JsonArray) Converts a JsonArray into the Decimal Extent
+ INT64 JsonArrayToInt64Extent (JsonArray) Converts a JsonArray into the INT64 Extent
+ INTEGER JsonArrayToIntegerExtent (JsonArray) Converts a JsonArray into the Integer Extent
+ LOGICAL JsonArrayToLogicalExtent (JsonArray) Converts a JsonArray into the Logical Extent
+ LONGCHAR JsonArrayToLongcharExtent (JsonArray) Converts a JsonArray into the Longchar Extent
+ Consultingwerk.JsonDataTypeEnum JsonDataTypeToEnum (integer) Returns the JsonDataTypeEnum member matching the provided Progress.Json.ObjectModel.JsonDataType integer value
+ Consultingwerk.ListNameValuePair JsonObjectToPropertyList (JsonObject, character) Converts a JsonObject to a property list
- JsonObjectToPropertyList (JsonObject, character, ListNameValuePair, character) Converts a JsonObject to a property list
+ CHARACTER ListFromAttributeValues (JsonObject, character) Returns a delimited list with the values of the given attributes of the JsonObject
+ CHARACTER ListFromAttributeValues (JsonObject, character, character) Returns a delimited list with the values of the given attributes of the JsonObject
+ MergeJsonArrays (JsonArray, JsonArray) Copies the entries of the source JsonArray to the Target JsonArray
+ MergeJsonObjects (JsonObject, JsonObject) Copies the properties of the source JsonObject to the Target JsonObject
+ Progress.Json.ObjectModel.JsonConstruct ParseFile (character) Parses a JSON File
+ LOGICAL RemoveEmptyNestedArrays (JsonObject) Removes empty nested JSON Arrays
# CHARACTER RestorePathEntry (character) Restores a path entry by reversing the SanitizePath
# CHARACTER SanitizePath (character) Sanitizes the JSON path
+ SetPropertyByPath (JsonObject, character, character, character) Assigns a property value to (nested) JSON Objects based on a path
- SetPropertyByPath (JsonObject, character, integer, character, character) Assigns a property value to (nested) JSON Objects based on a path
+ CHARACTER ToCharacter (JsonConstruct) Returns the CHARACTER representation of the given JsonConstruct
+ CHARACTER ToDelimitedList (JsonArray) Returns the values (string, number, boolean, null) of the given JsonArray as a delimited list
+ CHARACTER ToDelimitedList (JsonArray, character) Returns the values (string, number, boolean, null) of the given JsonArray as a delimited list
+ CHARACTER ToDelimitedList (JsonObject, character) Returns an ABL delimited list with the values of the given JsonObject property.
+ CHARACTER ToDelimitedList (JsonObject, character, character) Returns an ABL delimited list with the values of the given JsonObject property.
+ Progress.Json.ObjectModel.JsonArray ToJsonArray (IJsonSerializable[]) Turns an ABL extent of JsonSerializable objects into an JsonArray
+ LONGCHAR ToLongchar (JsonObject) Returns the LONGCHAR representation of the given JsonObject

Top Constructor Summary
Options Name Purpose
# JsonHelper () Protected default constructor


Method Detail
Top

PUBLIC Consultingwerk.JsonDataTypeEnum AblDataTypeToJsonDataTypeEnum (character)

Purpose: Returns the JSON Type for the given ABL Data Type
Notes:

Parameters:
pcAblDataType CHARACTER
The ABL Data Type to return the JSON Type for
Returns Consultingwerk.JsonDataTypeEnum
The JsonDataTypeEnum member representing the JSON Data
Top

PUBLIC AddBufferFields (handle, JsonObject, character)

Purpose: Adds the given fields of a buffer to an JSON Object
Notes: Supports array fields, a record must be available

Parameters:
phBuffer HANDLE
The handle of the Buffer
poJsonObject Progress.Json.ObjectModel.JsonObject
The JsonObject to add the fields to
pcFields CHARACTER
Comma delimited list of field names to add or * for all fields. Fields may be qualified with a buffer name or not. When the buffer does not match the current buffer name, the fields are ignored
Top

PUBLIC AddBufferFields (handle, JsonObject, character, logical)

Purpose: Adds the given fields of a buffer to an JSON Object
Notes: Supports array fields, a record must be available

Parameters:
phBuffer HANDLE
The handle of the Buffer
poJsonObject Progress.Json.ObjectModel.JsonObject
The JsonObject to add the fields to
pcFields CHARACTER
Comma delimited list of field names to add or * for all fields. Fields may be qualified with a buffer name or not. When the buffer does not match the current buffer name, the fields are ignored
plIgnoreDuplicates LOGICAL
Logical value indicating if duplicate attributes will be ignored
Top

PUBLIC AddBufferFields (handle, JsonObject, character, logical, logical)

Purpose: Adds the given fields of a buffer to an JSON Object
Notes: Supports array fields, a record must be available

Parameters:
phBuffer HANDLE
The handle of the Buffer
poJsonObject Progress.Json.ObjectModel.JsonObject
The JsonObject to add the fields to
pcFields CHARACTER
Comma delimited list of field names to add or * for all fields. Fields may be qualified with a buffer name or not. When the buffer does not match the current buffer name, the fields are ignored
plIgnoreDuplicates LOGICAL
Logical value indicating if duplicate attributes will be ignored
plIgnoreSerializeHidden LOGICAL
Logical value indicating if fields marked with SERIALIZE-HIDDEN should be skipped during export
Top

PUBLIC Progress.Json.ObjectModel.JsonArray AddNewJsonArray (JsonObject, character)

Purpose: Adds a new JsonArray to the given JsonObject
Notes:

Parameters:
poJsonObject Progress.Json.ObjectModel.JsonObject
The existing parent JSON Object
pcPropertyName CHARACTER
The name of the property to add the new object to
Returns Progress.Json.ObjectModel.JsonArray
The new JsonArray
Top

PUBLIC Progress.Json.ObjectModel.JsonObject AddNewJsonObject (JsonArray)

Purpose: Adds a new JsonObject to the given JsonArray
Notes:

Parameters:
poJsonArray Progress.Json.ObjectModel.JsonArray
The existing parent JSON Array
Returns Progress.Json.ObjectModel.JsonObject
The new JsonObject
Top

PUBLIC Progress.Json.ObjectModel.JsonObject AddNewJsonObject (JsonObject, character)

Purpose: Adds a new JsonObject to the given JsonObject
Notes:

Parameters:
poJsonObject Progress.Json.ObjectModel.JsonObject
The existing parent JSON Object
pcPropertyName CHARACTER
The name of the property to add the new object to
Returns Progress.Json.ObjectModel.JsonObject
The new JsonObject
Top

PUBLIC AddObjectPropertiesToJson (Object, JsonObject, character)

Purpose: Adds the properties of the given ABL Object to the
JSON Object
Notes:

Parameters:
poObject Progress.Lang.Object
The ABL object to add properties from
poJson Progress.Json.ObjectModel.JsonObject
The JSON object to add properties to
pcExceptPropertyNames CHARACTER
The property names to exclude from the result
Top

PUBLIC AddObjectPropertiesToJsonArray (Object, JsonArray, character, character, character)

Purpose: Adds the properties of the given ABL Object to the
JSON Array as name/value pairs
Notes:

Parameters:
poObject Progress.Lang.Object
The ABL object to add properties from
poJsonArray Progress.Json.ObjectModel.JsonArray
The JSON object to add properties to
pcExceptPropertyNames CHARACTER
The property names to exclude from the result
pcKey CHARACTER
The name of the json property to hold the ABL property name
pcValue CHARACTER
The name of the json property to hold the ABL property value
Top

PUBLIC AddObjectPropertiesToJsonArray (Object, JsonArray, character, character, character, character)

Purpose: Adds the properties of the given ABL Object to the
JSON Array as name/value pairs
Notes:

Parameters:
poObject Progress.Lang.Object
The ABL object to add properties from
poJsonArray Progress.Json.ObjectModel.JsonArray
The JSON object to add properties to
pcExceptPropertyNames CHARACTER
The property names to exclude from the result
pcKey CHARACTER
The name of the json property to hold the ABL property name
pcValue CHARACTER
The name of the json property to hold the ABL property value
pcPrefix CHARACTER
The property name prefix
Top

PUBLIC AddSetPropertyValue (JsonObject, character, character)

Purpose: Adds or sets a property to a JsonObject
Notes:

Parameters:
poJson Progress.Json.ObjectModel.JsonObject
The reference to the JSON object
pcPropertyName CHARACTER
The name of the property
pcPropertyValue CHARACTER
The value to assign to the property
Top

PUBLIC AddWidgetPropertiesToJsonArray (handle, JsonArray, character, character, character)

Purpose: Adds the properties of the given widget to the
JSON Array as name/value pairs
Notes:

Parameters:
phWidget HANDLE
The handle of the widget to add properties from
poJsonArray Progress.Json.ObjectModel.JsonArray
The JSON object to add properties to
pcExceptPropertyNames CHARACTER
The property names to exclude from the result
pcKey CHARACTER
The name of the json property to hold the ABL property name
pcValue CHARACTER
The name of the json property to hold the ABL property value
Top

PUBLIC AssignBufferFieldFromJson (handle, JsonObject)

Purpose: Assigns fields of the buffer from the values of the JSON object
Notes:

Parameters:
phBufferField HANDLE
The handle of the buffer to assign to
poJson Progress.Json.ObjectModel.JsonObject
The JsonObject to assign from
Top

PUBLIC AssignBufferFromJson (handle, JsonObject, character, character)

Purpose: Assigns fields of the buffer from the values of the JSON object
Notes:

Parameters:
phBuffer HANDLE
The handle of the buffer to assign to
poJson Progress.Json.ObjectModel.JsonObject
The JsonObject to assign from
pcIgnoreProperties CHARACTER
Comma delimited list of JSON properties to ignore
pcIncludeFields CHARACTER
Comma delimited list of fields to include, if set only those fields will be handled, * (or empty) for all fields. Fields may be qualified with a buffer name or not. When the buffer does not match the current buffer name, the fields are ignored
Top

PUBLIC AssignJsonObjectPropertiesFromString (JsonObject, character)

Purpose: Assigns properties in the given JsonObject from a Character value
Notes: The character value must be in the form of the html style attribute, e.g.:
background-color:LightCyan; LightCyan; width:200; xyz: "otto"
Does not support nested objects or arrays
Supports integer and character properties

Parameters:
poJsonObject Progress.Json.ObjectModel.JsonObject
The JsonObject to add the properties to
pcProperties CHARACTER
The string containing the properties
Top

PUBLIC CHARACTER AttributeValueList (JsonArray, character)

Purpose: Builds a Character list of the property values in all objects of the array
Notes:

Parameters:
poJsonArray Progress.Json.ObjectModel.JsonArray
The JsonArray
pcPropertyName CHARACTER
The name of the property to build a list of
Returns CHARACTER
The comma delimited list of property values
Top

PUBLIC CHARACTER AttributeValueList (JsonArray, character, character)

Purpose: Builds a Character list of the property values in all objects of the array
Notes:

Parameters:
poJsonArray Progress.Json.ObjectModel.JsonArray
The JsonArray
pcPropertyName CHARACTER
The name of the property to build a list of
pcDelimiter CHARACTER
The list delimiter
Returns CHARACTER
The delimited list of property values
Top

PUBLIC Progress.Json.ObjectModel.JsonObject CharacterDictionaryToJsonObject (CharacterDictionary)

Purpose: Returns a JsonObject populated from a CharacterDictionary
Notes:

Parameters:
poCharacterDictionary Consultingwerk.Framework.Collections.CharacterDictionary
The CharacterDictionary to convert
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject
Top

PUBLIC CopyProperties (JsonObject, JsonObject, character)

Purpose: Copies the given JSON Properties from the source JSON to
the target JSON
Notes:

Parameters:
poSourceObject Progress.Json.ObjectModel.JsonObject
The source JSON object
poTargetObject Progress.Json.ObjectModel.JsonObject
The target JSON object
pcPropertyNames CHARACTER
The names of the properties to copy
Top

PUBLIC EnsureCharacterProperty (JsonObject, character)

Purpose: Ensures that a primitive JSON property is a character
Notes: Converts boolean and numeric properties to CHARACTER

Parameters:
poJsonObject Progress.Json.ObjectModel.JsonObject
The JSON object that contains the character
pcPropertyName CHARACTER
The property to convert to character
Top

PUBLIC CHARACTER ExactPropertyName (JsonObject, character)

Purpose: Returns the property name if found in the JSON object in the exact case
as it appears in the JSON object
Notes: Returns ? when the property is not available

Parameters:
poJsonObject Progress.Json.ObjectModel.JsonObject
The JsonObject to search for the property in
pcPropertyName CHARACTER
The property name
Returns CHARACTER
The exact property name as it appears in the JSON object
Top

PUBLIC Progress.Json.ObjectModel.JsonConstruct FindJsonConstruct (JsonConstruct, character)

Purpose: Recursively searches the passed in JsonObject
for an JsonObject or JsonArray (JsonConstruct) under
a property with the given name
Notes:

Parameters:
poJson Progress.Json.ObjectModel.JsonConstruct
The input JsonConstruct
pcPropertyName CHARACTER
The name of the property to locate
Returns Progress.Json.ObjectModel.JsonConstruct
The matching JsonConstruct
Top

PUBLIC Progress.Json.ObjectModel.JsonObject FindJsonObjectWithArrayValue (JsonArray, character, integer)

Purpose: Locates the JsonObject from a JsonArray with the requested
integer value in a JsonArray property
Notes:

Parameters:
poJsonArray Progress.Json.ObjectModel.JsonArray
The JsonArray
pcPropertyName CHARACTER
The name of the property
piPropertyValue INTEGER
The value of the property
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject or ? when the property value cannot be found
Top

PUBLIC Progress.Json.ObjectModel.JsonObject FindJsonObjectWithPropertyValue (JsonArray, character, character)

Purpose: Locates the JsonObject from a JsonArray with the requested
character property value
Notes:

Parameters:
poJsonArray Progress.Json.ObjectModel.JsonArray
The JsonArray
pcPropertyName CHARACTER
The name of the property
pcPropertyValue CHARACTER
The value of the property
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject or ? when the property value cannot be found
Top

PUBLIC Progress.Json.ObjectModel.JsonObject FindJsonObjectWithPropertyValue (JsonArray, character, integer)

Purpose: Locates the JsonObject from a JsonArray with the requested
integer property value
Notes:

Parameters:
poJsonArray Progress.Json.ObjectModel.JsonArray
The JsonArray
pcPropertyName CHARACTER
The name of the property
piPropertyValue INTEGER
The value of the property
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject or ? when the property value cannot be found
Top

PUBLIC Progress.Json.ObjectModel.JsonObject FromDataset (handle)

Purpose: Returns the JSON Object with the contents of the given ProDataset
Notes: Workaround, as the Dataset'S WRITE-JSON method does not support
writing to a JsonObject directly

Parameters:
phDataset HANDLE
The handle of the dataset to return as JSON
Returns Progress.Json.ObjectModel.JsonObject
The resulting JsonObject
Top

PUBLIC Progress.Json.ObjectModel.JsonObject FromDataset (handle, logical)

Purpose: Returns the JSON Object with the contents of the given ProDataset
Notes: Workaround, as the Dataset'S WRITE-JSON method does not support
writing to a JsonObject directly

Parameters:
phDataset HANDLE
The handle of the dataset to return as JSON
plIncludeBeforeImage LOGICAL
Logical value indicating if the ProDataset before-tables should should be written as well
Returns Progress.Json.ObjectModel.JsonObject
The resulting JsonObject
Top

PUBLIC Progress.Json.ObjectModel.JsonObject FromTempTable (handle)

Purpose: Returns the JSON Object with the contents of the given Temp-Table
Notes: Workaround, as the Temp-Table'S WRITE-JSON method does not support
writing to a JsonObject directly

Parameters:
phTempTable HANDLE
The handle of the Temp-Table to return as JSON
Returns Progress.Json.ObjectModel.JsonObject
The resulting JsonObject
Top

PUBLIC CHARACTER GetCharacterByPath (JsonObject, character)

Purpose: Returns the Character Value specified by the given path
Notes: Based on GetJsonObjectByPath, the last part of the path specifies
the property name
Supports tilde for escaping path delimiters

Parameters:
poSourceJsonObject Progress.Json.ObjectModel.JsonObject
The source Json object that contains the target Json object
pcPath CHARACTER
The path specifying the target object
Returns CHARACTER
The character value or ? when the path is not valid
Top

PUBLIC CHARACTER GetCharacterByPath (JsonObject, character, ArrayBaseEnum)

Purpose: Returns the Character Value specified by the given path
Notes: Based on GetJsonObjectByPath, the last part of the path specifies
the property name
Supports tilde for escaping path delimiters

Parameters:
poSourceJsonObject Progress.Json.ObjectModel.JsonObject
The source Json object that contains the target Json object
pcPath CHARACTER
The path specifying the target object
poArrayBase Consultingwerk.ArrayBaseEnum
The array base (one or zero)
Returns CHARACTER
The character value or ? when the path is not valid
Top

PUBLIC INTEGER GetIntegerByPath (JsonObject, character)

Purpose: Returns the Integer Value specified by the given path
Notes: Based on GetJsonObjectByPath, the last part of the path specifies
the property name
Supports tilde for escaping path delimiters

Parameters:
poSourceJsonObject Progress.Json.ObjectModel.JsonObject
The source Json object that contains the target Json object
pcPath CHARACTER
The path specifying the target object
Returns INTEGER
The character value or ? when the path is not valid
Top

PUBLIC INTEGER GetIntegerByPath (JsonObject, character, ArrayBaseEnum)

Purpose: Returns the Integer Value specified by the given path
Notes: Based on GetJsonObjectByPath, the last part of the path specifies
the property name
Supports tilde for escaping path delimiters

Parameters:
poSourceJsonObject Progress.Json.ObjectModel.JsonObject
The source Json object that contains the target Json object
pcPath CHARACTER
The path specifying the target object
poArrayBase Consultingwerk.ArrayBaseEnum
The array base (one or zero)
Returns INTEGER
The character value or ? when the path is not valid
Top

PUBLIC Progress.Json.ObjectModel.JsonArray GetJsonArrayByPath (JsonObject, character)

Purpose: Returns the Json Array represented by a path in the source
Json Object
Notes: The path entries can be delimited by either period (.), slash (/)
or back-slash (\)
Defaults to 1 based arrays (ABL default), Sample path:
dsCustomer.eCustomer[1].eSalesRep[1]
Supports tilde for escaping path delimiters

Parameters:
poSourceJsonObject Progress.Json.ObjectModel.JsonObject
The source Json object that contains the target Json object
pcPath CHARACTER
The path specifying the target object
Returns Progress.Json.ObjectModel.JsonArray
The target Json object
Top

PUBLIC Progress.Json.ObjectModel.JsonArray GetJsonArrayByPath (JsonObject, character, ArrayBaseEnum)

Purpose: Returns the Json Array represented by a path in the source
Json Object
Notes: The path entries can be delimited by either period (.), slash (/)
or back-slash (\)
dsCustomer.eCustomer[1].eSalesRep[1]
Supports tilde for escaping path delimiters

Parameters:
poSourceJsonObject Progress.Json.ObjectModel.JsonObject
The source Json object that contains the target Json object
pcPath CHARACTER
The path specifying the target object
poArrayBase Consultingwerk.ArrayBaseEnum
The array base (one or zero)
Returns Progress.Json.ObjectModel.JsonArray
The target Json object
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetJsonObjectByPath (JsonObject, character)

Purpose: Returns the Json Object represented by a path in the source
Json Object
Notes: The path entries can be delimited by either period (.), slash (/)
or back-slash (\)
Defaults to 1 based arrays (ABL default), Sample path:
dsCustomer.eCustomer[1].eSalesRep[1]
Supports tilde for escaping path delimiters

Parameters:
poSourceJsonObject Progress.Json.ObjectModel.JsonObject
The source Json object that contains the target Json object
pcPath CHARACTER
The path specifying the target object
Returns Progress.Json.ObjectModel.JsonObject
The target Json object
Top

PUBLIC Progress.Json.ObjectModel.JsonObject GetJsonObjectByPath (JsonObject, character, ArrayBaseEnum)

Purpose: Returns the Json Object represented by a path in the source
Json Object
Notes: The path entries can be delimited by either period (.), slash (/)
or back-slash (\)
dsCustomer.eCustomer[1].eSalesRep[1]
Supports tilde for escaping path delimiters

Parameters:
poSourceJsonObject Progress.Json.ObjectModel.JsonObject
The source Json object that contains the target Json object
pcPath CHARACTER
The path specifying the target object
poArrayBase Consultingwerk.ArrayBaseEnum
The array base (one or zero)
Returns Progress.Json.ObjectModel.JsonObject
The target Json object
Top

PUBLIC LOGICAL GetLogicalByPath (JsonObject, character)

Purpose: Returns the Logical Value specified by the given path
Notes: Based on GetJsonObjectByPath, the last part of the path specifies
the property name
Supports tilde for escaping path delimiters

Parameters:
poSourceJsonObject Progress.Json.ObjectModel.JsonObject
The source Json object that contains the target Json object
pcPath CHARACTER
The path specifying the target object
Returns LOGICAL
The character value or ? when the path is not valid
Top

PUBLIC LOGICAL GetLogicalByPath (JsonObject, character, ArrayBaseEnum)

Purpose: Returns the Logical Value specified by the given path
Notes: Based on GetJsonObjectByPath, the last part of the path specifies
the property name
Supports tilde for escaping path delimiters

Parameters:
poSourceJsonObject Progress.Json.ObjectModel.JsonObject
The source Json object that contains the target Json object
pcPath CHARACTER
The path specifying the target object
poArrayBase Consultingwerk.ArrayBaseEnum
The array base (one or zero)
Returns LOGICAL
The character value or ? when the path is not valid
Top

PROTECTED GetObjectAndPropertyName (JsonObject, character, ArrayBaseEnum, JsonObject, character)

Purpose: Returns the JSON object that is referenced by the path and the
Property name
Notes: Helper method for GetCharacterByPath, GetIntegerByPath, GetLogicalByPath

Parameters:
poSourceJsonObject Progress.Json.ObjectModel.JsonObject
The source Json object that contains the target Json object
pcPath CHARACTER
The path specifying the target object
poArrayBase Consultingwerk.ArrayBaseEnum
The array base (one or zero)
poObject Progress.Json.ObjectModel.JsonObject
OUTPUT The object that contains the property
pcProperty CHARACTER
OUTPUT The name of the property
Top

PUBLIC LOGICAL IsInt64Property (JsonArray, integer)

Purpose: Returns if the given property is an Int64 value
Notes: As JSON does not distinguish between Integer and Decimal
it is required to test values for type compatibility

Parameters:
poJsonArray Progress.Json.ObjectModel.JsonArray
The JSON array
piIndex INTEGER
The array index to test for integer
Returns LOGICAL
Logical value indicating if the given property is Integer
Top

PUBLIC LOGICAL IsInt64Property (JsonObject, character)

Purpose: Returns if the given property is an Int64 value
Notes: As JSON does not distinguish between Integer and Decimal
it is required to test values for type compatibility

Parameters:
poJsonObject Progress.Json.ObjectModel.JsonObject
The JSON object
pcPropertyName CHARACTER
The property to test for integer
Returns LOGICAL
Logical value indicating if the given property is Integer
Top

PUBLIC LOGICAL IsIntegerProperty (JsonArray, integer)

Purpose: Returns if the given property is an Integer value
Notes: As JSON does not distinguish between Integer and Decimal
it is required to test values for type compatibility

Parameters:
poJsonArray Progress.Json.ObjectModel.JsonArray
The JSON array
piIndex INTEGER
The array index to test for integer
Returns LOGICAL
Logical value indicating if the given property is Integer
Top

PUBLIC LOGICAL IsIntegerProperty (JsonObject, character)

Purpose: Returns if the given property is an Integer value
Notes: As JSON does not distinguish between Integer and Decimal
it is required to test values for type compatibility

Parameters:
poJsonObject Progress.Json.ObjectModel.JsonObject
The JSON object
pcPropertyName CHARACTER
The property to test for integer
Returns LOGICAL
Logical value indicating if the given property is Integer
Top

PUBLIC CHARACTER JsonArrayToCharacterExtent (JsonArray)

Purpose: Converts a JsonArray into the Character Extent
Notes: Will error, when the values are not compatible to character

Parameters:
poArray Progress.Json.ObjectModel.JsonArray
The JsonArray to convert
Returns CHARACTER
The Character Extent field
Top

PUBLIC DATE JsonArrayToDateExtent (JsonArray)

Purpose: Converts a JsonArray into the Date Extent
Notes: Will error, when the values are not compatible to date

Parameters:
poArray Progress.Json.ObjectModel.JsonArray
The JsonArray to convert
Returns DATE
The Date Extent field
Top

PUBLIC DATETIME JsonArrayToDateTimeExtent (JsonArray)

Purpose: Converts a JsonArray into the DateTime Extent
Notes: Will error, when the values are not compatible to DateTime

Parameters:
poArray Progress.Json.ObjectModel.JsonArray
The JsonArray to convert
Returns DATETIME
The DateTime Extent field
Top

PUBLIC DATETIME-TZ JsonArrayToDateTimeTzExtent (JsonArray)

Purpose: Converts a JsonArray into the DateTime-TZ Extent
Notes: Will error, when the values are not compatible to DateTime-TZ

Parameters:
poArray Progress.Json.ObjectModel.JsonArray
The JsonArray to convert
Returns DATETIME-TZ
The DateTime-TZ Extent field
Top

PUBLIC DECIMAL JsonArrayToDecimalExtent (JsonArray)

Purpose: Converts a JsonArray into the Decimal Extent
Notes: Will error, when the values are not compatible to decimal

Parameters:
poArray Progress.Json.ObjectModel.JsonArray
The JsonArray to convert
Returns DECIMAL
The Decimal Extent field
Top

PUBLIC INT64 JsonArrayToInt64Extent (JsonArray)

Purpose: Converts a JsonArray into the INT64 Extent
Notes: Will error, when the values are not compatible to INT64

Parameters:
poArray Progress.Json.ObjectModel.JsonArray
The JsonArray to convert
Returns INT64
The INT64 Extent field
Top

PUBLIC INTEGER JsonArrayToIntegerExtent (JsonArray)

Purpose: Converts a JsonArray into the Integer Extent
Notes: Will error, when the values are not compatible to integer

Parameters:
poArray Progress.Json.ObjectModel.JsonArray
The JsonArray to convert
Returns INTEGER
The Integer Extent field
Top

PUBLIC LOGICAL JsonArrayToLogicalExtent (JsonArray)

Purpose: Converts a JsonArray into the Logical Extent
Notes: Will error, when the values are not compatible to logical

Parameters:
poArray Progress.Json.ObjectModel.JsonArray
The JsonArray to convert
Returns LOGICAL
The Logical Extent field
Top

PUBLIC LONGCHAR JsonArrayToLongcharExtent (JsonArray)

Purpose: Converts a JsonArray into the Longchar Extent
Notes: Will error, when the values are not compatible to longchar

Parameters:
poArray Progress.Json.ObjectModel.JsonArray
The JsonArray to convert
Returns LONGCHAR
The Longchar Extent field
Top

PUBLIC Consultingwerk.JsonDataTypeEnum JsonDataTypeToEnum (integer)

Purpose: Returns the JsonDataTypeEnum member matching the provided
Progress.Json.ObjectModel.JsonDataType integer value
Notes: OpenEdge is providing an integer constant to qualify JSON data type

Parameters:
piJsonDataType INTEGER
The JsonDataType integer value
Returns Consultingwerk.JsonDataTypeEnum
The matching JsonDataTypoToEnum enum member
Top

PUBLIC Consultingwerk.ListNameValuePair JsonObjectToPropertyList (JsonObject, character)

Purpose: Converts a JsonObject to a property list
Notes: { a: 123, b: { c: 456, d: 789 } } will be turned into
a = 123
b.c = 456
b.d = 789

Parameters:
poJson Progress.Json.ObjectModel.JsonObject
The JsonObject to convert
pcDelimiter CHARACTER
The delimiter to use when processing nested objects
Returns Consultingwerk.ListNameValuePair
The ListNameValuePair with the properties
Top

PRIVATE JsonObjectToPropertyList (JsonObject, character, ListNameValuePair, character)

Purpose: Converts a JsonObject to a property list
Notes: { a: 123, b: { c: 456, d: 789 } } will be turned into
a = 123
b.c = 456
b.d = 789

Parameters:
poJson Progress.Json.ObjectModel.JsonObject
The JsonObject to convert
pcDelimiter CHARACTER
The delimiter to use when processing nested objects
poList Consultingwerk.ListNameValuePair
The list to add properties to
pcPrefix CHARACTER
The prefix to use for the name
Top

PUBLIC CHARACTER ListFromAttributeValues (JsonObject, character)

Purpose: Returns a delimited list with the values of the given
attributes of the JsonObject
Notes:

Parameters:
poJsonObject Progress.Json.ObjectModel.JsonObject
The reference to the JsonObject
pcAttributeNames CHARACTER
The comma delimited list with the names of the JSON attributes
Returns CHARACTER
The delimited list with the values
Top

PUBLIC CHARACTER ListFromAttributeValues (JsonObject, character, character)

Purpose: Returns a delimited list with the values of the given
attributes of the JsonObject
Notes:

Parameters:
poJsonObject Progress.Json.ObjectModel.JsonObject
The reference to the JsonObject
pcAttributeNames CHARACTER
The comma delimited list with the names of the JSON attributes
pcDelimiter CHARACTER
The list delimited
Returns CHARACTER
The delimited list with the values
Top

PUBLIC MergeJsonArrays (JsonArray, JsonArray)

Purpose: Copies the entries of the source JsonArray to the Target JsonArray
Notes: Treats all numbers as Integer

Parameters:
poSource Progress.Json.ObjectModel.JsonArray
The source JsonArray
poTarget Progress.Json.ObjectModel.JsonArray
The target JsonArray
Top

PUBLIC MergeJsonObjects (JsonObject, JsonObject)

Purpose: Copies the properties of the source JsonObject to the Target JsonObject
Notes: Treats all numbers as Integer

Parameters:
poSource Progress.Json.ObjectModel.JsonObject
The source JsonObject
poTarget Progress.Json.ObjectModel.JsonObject
The target JsonObject
Top

PUBLIC Progress.Json.ObjectModel.JsonConstruct ParseFile (character)

Purpose: Parses a JSON File
Notes: Provides improved error handling and PROPATH lookup for the file

Parameters:
pcFileName CHARACTER
The JSON File to Parse
Returns Progress.Json.ObjectModel.JsonConstruct
The JsonConstruct
Top

PUBLIC LOGICAL RemoveEmptyNestedArrays (JsonObject)

Purpose: Removes empty nested JSON Arrays
Notes: SCL-1796, removed eSalesrep: [ {} ] from the JSON
Object, recursively processes the JSON data

Parameters:
poJsonObject Progress.Json.ObjectModel.JsonObject
The JsonObject to remove
Returns LOGICAL
Logical value indicating if the JSON has been modified
Top

PROTECTED CHARACTER RestorePathEntry (character)

Purpose: Restores a path entry by reversing the SanitizePath
Notes:

Parameters:
pcEntry CHARACTER
An entry of the JSON Path
Returns CHARACTER
The restored variant
Top

PROTECTED CHARACTER SanitizePath (character)

Purpose: Sanitizes the JSON path
Notes: Replaces ~. ~/ and ~\ with CHR(1) CHR(2) and CHR(3)

Parameters:
pcPath CHARACTER
The original path
Returns CHARACTER
The sanitized path
Top

PUBLIC SetPropertyByPath (JsonObject, character, character, character)

Purpose: Assigns a property value to (nested) JSON Objects based on a path
Notes: Can be used to assign the Serialized Type Information to a set of
JSON Objects
Will assign the SerializedType to the JsonObject referenced by the Abc property in the given JsonObject:
JsonHelper:SetCharacterProperty SetCharacterProperty SetPropertyByPath (oJson, "Abc", "SerializedType", "Consultingwerk.CharacterHelper").
Will assign the SerializedType to all JsonObjects contained in the JsonArray referenced by the Abc property in the given JsonObject:
JsonHelper:SetCharacterProperty SetCharacterProperty SetPropertyByPath (oJson, "Abc[]", "SerializedType", "Consultingwerk.CharacterHelper").
Will first iterate all JsonObjects in the Abc JsonArray, and for each JsonObject in that array, iterate all objects in the Def JsonArray.
JsonHelper: SetCharacterProperty SetPropertyByPath (oJson, "Abc[].Def[]", "SerializedType", "Consultingwerk.CharacterHelper")

Parameters:
poJson Progress.Json.ObjectModel.JsonObject
The reference to the JSON Object to process
pcPropertyPath CHARACTER
The path of the JSON Objects to assign the property to
pcPropertyName CHARACTER
The name of the property to assign/set
pcPropertyValue CHARACTER
The value for the property
Top

PRIVATE SetPropertyByPath (JsonObject, character, integer, character, character)

Purpose: Assigns a property value to (nested) JSON Objects based on a path
Notes: Internal worker method for PUBLIC STATIC SetPropertyByPath

Parameters:
poJson Progress.Json.ObjectModel.JsonObject
The reference to the JSON construct to process
pcPropertyPath CHARACTER
The path of the JSON Objects to assign the property to
piLevel INTEGER
The position in the path to process
pcPropertyName CHARACTER
The name of the property to assign/set
pcPropertyValue CHARACTER
The value for the property
Top

PUBLIC CHARACTER ToCharacter (JsonConstruct)

Purpose: Returns the CHARACTER representation of the given JsonConstruct
Notes: Truncates the JSON String to 20000 characters

Parameters:
poJsonObject Progress.Json.ObjectModel.JsonConstruct
The JsonConstruct to return the longchar representation of
Returns CHARACTER
The Character representation of the given string
Top

PUBLIC CHARACTER ToDelimitedList (JsonArray)

Purpose: Returns the values (string, number, boolean, null) of the given JsonArray
as a delimited list
Notes:

Parameters:
poJsonArray Progress.Json.ObjectModel.JsonArray
The JsonArray to process
Returns CHARACTER
The delimited list of values
Top

PUBLIC CHARACTER ToDelimitedList (JsonArray, character)

Purpose: Returns the values (string, number, boolean, null) of the given JsonArray
as a delimited list
Notes:

Parameters:
poJsonArray Progress.Json.ObjectModel.JsonArray
The JsonArray to process
pcDelimiter CHARACTER
The list delimiter
Returns CHARACTER
The delimited list of values
Top

PUBLIC CHARACTER ToDelimitedList (JsonObject, character)

Purpose: Returns an ABL delimited list with the values of the given
JsonObject property.
Notes: The value of the property must either be a single string or
an JsonArray of strings or null

Parameters:
poJsonObject Progress.Json.ObjectModel.JsonObject
The source JsonObject
pcPropertyName CHARACTER
The name of the property of the JsonObject to return
Returns CHARACTER
The delimited list
Top

PUBLIC CHARACTER ToDelimitedList (JsonObject, character, character)

Purpose: Returns an ABL delimited list with the values of the given
JsonObject property.
Notes: The value of the property must either be a single string or
an JsonArray of strings or null

Parameters:
poJsonObject Progress.Json.ObjectModel.JsonObject
The source JsonObject
pcPropertyName CHARACTER
The name of the property of the JsonObject to return
pcDelimiter CHARACTER
The delimiter for the list to return
Returns CHARACTER
The delimited list
Top

PUBLIC Progress.Json.ObjectModel.JsonArray ToJsonArray (IJsonSerializable[])

Purpose: Turns an ABL extent of JsonSerializable objects into an JsonArray
Notes:

Parameters:
poJsonSerializable Consultingwerk.IJsonSerializable
The Array of JsonSerializable objects
Returns Progress.Json.ObjectModel.JsonArray
The JsonArray
Top

PUBLIC LONGCHAR ToLongchar (JsonObject)

Purpose: Returns the LONGCHAR representation of the given JsonObject
Notes:

Parameters:
poJsonObject Progress.Json.ObjectModel.JsonObject
The JsonObject to return the longchar representation of
Returns LONGCHAR
The Longchar representation of the given string


Constructor Detail
Top

PROTECTED JsonHelper ()

Purpose: Protected default constructor
Notes: Disallow instance creation



©2006-2023 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       15.04.2024 06:16:41