Namespace: OpenEdge.Core.Json
Class
JsonConverter
Parent classes:
Progress.Lang.Object

Inherits: Progress.Lang.Object

/* *************************************************************************************************************************
Copyright (c) 2019-2020 by Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved.
File:JsonConverter
Description:Helps to convert to and from JSON, for common/standard (Ccs.Common.Support.I*Holder,
OpenEdge.Core.Collections.I*) types
Author(s):pjudge
Created:2019-11-21
/* Default constructor.
This is private so that this class cannot be instantiated - it's intended to be used with static members only




Method Summary
Options Name Purpose
AddToArray (integer, Object, JsonArray) /* Adds an instance value into a JSON array @param integer The index at which to add the value. the array may be extended to this value @param Progress.Lang.Object A value to be written for the property. May be null. @param JsonObject A JSON array. Must exist. */
AddToObject (Object, Object, JsonObject) /* Adds a value into a JSON object for a specific key @param Progress.Lang.Object The key value - property name (required) @param Progress.Lang.Object A value to be written for the property. May be null. @param JsonObject A JSON object */
Merge (JsonObject, JsonObject, logical) /* Merges (combines) two JSON objects. Properties are copied from the SOURCE into the TARGET. If the property exists in the target, it is overwritten by the source property if the pOverwriteExisting flag is TRUE. @param JsonObject The target JSON object. Must exist. @param JsonObject The source JSON object. Can be null @param logical TRUE if properties from the SOURCE object should overwrite those in the TARGET */
Progress.Json.ObjectModel.JsonArray ToArray (ICollection) /* Converts an instance of a collection into a JSONArray Invalid inputs, indeterminate arrays, all get a null value @param ICollection The input collection @return JsonArray An array instance */
Progress.Json.ObjectModel.JsonArray ToArray (IObjectArrayHolder) /* Converts an array of objects into into a JSONArray Invalid inputs, indeterminate arrays, all get a null value @param IObjectArrayHolder The input array @return JsonArray An array instance */
Progress.Json.ObjectModel.JsonArray ToArray (IPrimitiveArrayHolder) /* Converts an instance of a IPrimitiveArrayHolder into a JSONArray Invalid inputs, indeterminate arrays, all get a null value @param IPrimitiveArrayHolder The input value @return JsonArray An array instance */
Progress.Json.ObjectModel.JsonArray ToArray (Object[]) /* Converts an array of objects into into a JSONArray Invalid inputs, indeterminate arrays, all get a null value @param P.L.Object[] The input array @return JsonArray An array instance */
Progress.Lang.Enum ToEnum (JsonArray, integer, Class) /* This method converts a JSON array element to an instance of an P.L.Enum. The element value must be either a string or number. If the inputs are invalid, or the index is not in range, or the value is of the wrong JSON type, an unknown value is returned. If the ToObject() call fails, an error is raised. @param JsonArray The array @param integer The element index @param P.L.Class The type of the enum @return Progress.Lang.Enum The enum */
Progress.Lang.Enum ToEnum (JsonObject, character, Class) /* This method converts a JSON property to an instance of an P.L.Enum. The property value must be either a string or number. If the inputs are invalid, or the property does not exist, or is of the wrong JSON type, enum, an unknown value is returned. If the ToObject() call fails, an error is raised @param JsonObject The object @param character The property name @param P.L.Class The type of the enum @return Progress.Lang.Enum The enum */
Progress.Json.ObjectModel.JsonObject ToObject (IMap) /* Converts an instance of a KeyValuePair into a JSON Object Invalid inputs, indeterminate arrays, all get an @param IMap A map (collection of name/value pairs) @return JsonObject A JSON object */
Progress.Json.ObjectModel.JsonObject ToObject (KeyValuePair) /* Converts an instance of a KeyValuePair into a JSON Object Invalid inputs, indeterminate arrays, all get an @param KeyValuePair A name/value pair @return JsonObject A JSON object */
Progress.Json.ObjectModel.JsonObject ToObject (Error) /* Converts an instance of a Progress.Lang.Error into a JSON Object @param Progress.Lang.Error An error. Must exist @return JsonObject A JSON object representing the Error */
Progress.Json.ObjectModel.JsonObject ToObject (Object, Object) /* Converts an kay and value into a JSON Object @param Progress.Lang.Object The key value - property name (required) @param Progress.Lang.Object A value to be written for the property. May be null. @return JsonObject A JSON object */
OpenEdge.Core.IObjectArrayHolder ToObjectArray (JsonArray) /* Converts a JSON array to an instance of a IObjectArrayHolder @param JsonArray A JSON array. May be invalid/null @return IObjectArrayHolder The array holder. One is always returned. */
OpenEdge.Core.IObjectArrayHolder ToObjectArray (JsonArray, Class) /* Converts a JSON array to an instance of a IObjectArrayHolder @param JsonArray A JSON array. May be invalid/null @param P.L.Class The type of the elements in the array @return IObjectArrayHolder The array holder. One is always returned. */
Ccs.Common.Support.IPrimitiveArrayHolder ToPrimitiveArray (JsonArray) /* Converts a JSON array to an instance of a PrimitiveArrayHolder The first non-null element is used to infer the array's ABL type. Objects and Arrays are returned as JSON text. @param JsonArray A JSON array. May be invalid/null @return IPrimitiveArrayHolder The array holder. One is always returned. */
Ccs.Common.Support.IPrimitiveHolder ToScalar (JsonArray, integer) /* This method converts a JSON array element to an instance of an IPrimitiveHolder. If the inputs are invalid, or the index is not in range, an object represeting the unknown value is returned. If the property value cannot be converted, an object represeting the unknown value is returned. Thie methods will try to convert JSON Strings into date/time/tz or memptr values before returning a string JSON objects and arrayas are returned as Json text values (ie flattened) @param JsonArray The object @param integer The element index @return IPrimitiveHolder The representative value */
Ccs.Common.Support.IPrimitiveHolder ToScalar (JsonObject, character) /* This method converts a JSON property to an instance of an IPRimitiveHolder. If the inputs are invalid, an object represeting the unknown value is returned. If the property value cannot be converted, an object represeting the unknown value is returned. Thie methods will try to convert JSON Strings into date/time/tz or memptr values before returning a string JSON objects and arrayas are returned as Json text values (ie flattened) @param JsonObject The object @param character The property name @return IPrimitiveHolder The representative value */

Constructor Summary
Options Name Purpose
JsonConverter () /* Default constructor. This is private so that this class cannot be instantiated - it's intended to be used with static members only */


Method Detail
Top

AddToArray (integer, Object, JsonArray)

/* Adds an instance value into a JSON array
Parameters:
pIdx INTEGER
pValue Progress.Lang.Object
pJson Progress.Json.ObjectModel.JsonArray
Top

AddToObject (Object, Object, JsonObject)

/* Adds a value into a JSON object for a specific key
Parameters:
pKey Progress.Lang.Object
pValue Progress.Lang.Object
pJson Progress.Json.ObjectModel.JsonObject
Top

Merge (JsonObject, JsonObject, logical)

/* Merges (combines) two JSON objects.
Properties are copied from the SOURCE into the TARGET.
If the property exists in the target, it is overwritten by
the source property if the pOverwriteExisting flag is TRUE.
Parameters:
pTarget Progress.Json.ObjectModel.JsonObject
pSource Progress.Json.ObjectModel.JsonObject
pOverwriteExisting LOGICAL
Top

Progress.Json.ObjectModel.JsonArray ToArray (ICollection)

/* Converts an instance of a collection into a JSONArray
Invalid inputs, indeterminate arrays, all get a null value
Parameters:
pCollection OpenEdge.Core.Collections.ICollection
Returns Progress.Json.ObjectModel.JsonArray
JsonArray An array instance
Top

Progress.Json.ObjectModel.JsonArray ToArray (IObjectArrayHolder)

/* Converts an array of objects into into a JSONArray
Invalid inputs, indeterminate arrays, all get a null value
Parameters:
pArray OpenEdge.Core.IObjectArrayHolder
Returns Progress.Json.ObjectModel.JsonArray
JsonArray An array instance
Top

Progress.Json.ObjectModel.JsonArray ToArray (IPrimitiveArrayHolder)

/* Converts an instance of a IPrimitiveArrayHolder into a JSONArray
Invalid inputs, indeterminate arrays, all get a null value
Parameters:
pArray Ccs.Common.Support.IPrimitiveArrayHolder
Returns Progress.Json.ObjectModel.JsonArray
JsonArray An array instance
Top

Progress.Json.ObjectModel.JsonArray ToArray (Object[])

/* Converts an array of objects into into a JSONArray
Invalid inputs, indeterminate arrays, all get a null value
Parameters:
pArray Progress.Lang.Object
Returns Progress.Json.ObjectModel.JsonArray
JsonArray An array instance
Top

Progress.Lang.Enum ToEnum (JsonArray, integer, Class)

/* This method converts a JSON array element to an instance of an P.L.Enum.
The element value must be either a string or number.
If the inputs are invalid, or the index is not in range, or the value is of the wrong JSON type,
an unknown value is returned.
If the ToObject() call fails, an error is raised.
Parameters:
pArray Progress.Json.ObjectModel.JsonArray
pIdx INTEGER
pEnumType Progress.Lang.Class
Returns Progress.Lang.Enum
Progress.Lang.Enum The enum
Top

Progress.Lang.Enum ToEnum (JsonObject, character, Class)

/* This method converts a JSON property to an instance of an P.L.Enum.
The property value must be either a string or number.
If the inputs are invalid, or the property does not exist, or is of the wrong JSON type,
enum, an unknown value is returned.
If the ToObject() call fails, an error is raised
Parameters:
pObject Progress.Json.ObjectModel.JsonObject
pName CHARACTER
pEnumType Progress.Lang.Class
Returns Progress.Lang.Enum
Progress.Lang.Enum The enum
Top

Progress.Json.ObjectModel.JsonObject ToObject (IMap)

/* Converts an instance of a KeyValuePair into a JSON Object
Invalid inputs, indeterminate arrays, all get an
Parameters:
pMap OpenEdge.Core.Collections.IMap
Returns Progress.Json.ObjectModel.JsonObject
JsonObject A JSON object
Top

Progress.Json.ObjectModel.JsonObject ToObject (KeyValuePair)

/* Converts an instance of a KeyValuePair into a JSON Object
Invalid inputs, indeterminate arrays, all get an
Parameters:
pTuple OpenEdge.Core.KeyValuePair
Returns Progress.Json.ObjectModel.JsonObject
JsonObject A JSON object
Top

Progress.Json.ObjectModel.JsonObject ToObject (Error)

/* Converts an instance of a Progress.Lang.Error into a JSON Object
Parameters:
pError Progress.Lang.Error
Returns Progress.Json.ObjectModel.JsonObject
JsonObject A JSON object representing the Error
Top

Progress.Json.ObjectModel.JsonObject ToObject (Object, Object)

/* Converts an kay and value into a JSON Object
Parameters:
pKey Progress.Lang.Object
pValue Progress.Lang.Object
Returns Progress.Json.ObjectModel.JsonObject
JsonObject A JSON object
Top

OpenEdge.Core.IObjectArrayHolder ToObjectArray (JsonArray)

/* Converts a JSON array to an instance of a IObjectArrayHolder
Parameters:
pArray Progress.Json.ObjectModel.JsonArray
Returns OpenEdge.Core.IObjectArrayHolder
IObjectArrayHolder The array holder. One is always returned.
Top

OpenEdge.Core.IObjectArrayHolder ToObjectArray (JsonArray, Class)

/* Converts a JSON array to an instance of a IObjectArrayHolder
Parameters:
pArray Progress.Json.ObjectModel.JsonArray
pElementType Progress.Lang.Class
Returns OpenEdge.Core.IObjectArrayHolder
IObjectArrayHolder The array holder. One is always returned.
Top

Ccs.Common.Support.IPrimitiveArrayHolder ToPrimitiveArray (JsonArray)

/* Converts a JSON array to an instance of a PrimitiveArrayHolder
The first non-null element is used to infer the array's ABL type.
Objects and Arrays are returned as JSON text.
Parameters:
pArray Progress.Json.ObjectModel.JsonArray
Returns Ccs.Common.Support.IPrimitiveArrayHolder
IPrimitiveArrayHolder The array holder. One is always returned.
Top

Ccs.Common.Support.IPrimitiveHolder ToScalar (JsonArray, integer)

/* This method converts a JSON array element to an instance of an IPrimitiveHolder.
If the inputs are invalid, or the index is not in range, an object represeting the unknown value is returned.
If the property value cannot be converted, an object represeting the unknown value is returned.
Thie methods will try to convert JSON Strings into date/time/tz or memptr values before returning a string
JSON objects and arrayas are returned as Json text values (ie flattened)
Parameters:
pArray Progress.Json.ObjectModel.JsonArray
pIdx INTEGER
Returns Ccs.Common.Support.IPrimitiveHolder
IPrimitiveHolder The representative value
Top

Ccs.Common.Support.IPrimitiveHolder ToScalar (JsonObject, character)

/* This method converts a JSON property to an instance of an IPRimitiveHolder.
If the inputs are invalid, an object represeting the unknown value is returned.
If the property value cannot be converted, an object represeting the unknown value is returned.
Thie methods will try to convert JSON Strings into date/time/tz or memptr values before returning a string
JSON objects and arrayas are returned as Json text values (ie flattened)
Parameters:
pObject Progress.Json.ObjectModel.JsonObject
pName CHARACTER
Returns Ccs.Common.Support.IPrimitiveHolder
IPrimitiveHolder The representative value


Constructor Detail
Top

JsonConverter ()

/* Default constructor.
This is private so that this class cannot be instantiated - it's intended to be used with static members only


Copyright © 2022 Progress Software Corporation. All rights Reserved.

Progress® OpenEdge® Release 11.7.15