GetJsonObject( ) method (JsonObject)

Gets the JsonObject value of the named property.

Return type: Progress.Json.ObjectModel.JsonObject class

Access: PUBLIC

Applies to: Progress.Json.ObjectModel.JsonObject class

Syntax

GetJsonObject( INPUT property-name AS CHARACTER )
property-name
A CHARACTER expression that indicates the name the property value to be retrieved from the JsonObject.

A JsonError is raised if:

The following example demonstrates the functionality of the GetJSonObject( ) method.

The following is a sample JsonObject:

{
  "CustOrder": {
    "CustNum": 1,
    "Name": "Lift Tours",
    "NewCust": false,
    "Order": {"OrderNum": 82, "OrderDate": "2010-09-20"}
    ]
  }
}

The following code fragment uses the GetJsonObject( ) method:

DEFINE VARIABLE CustInfo AS LONGCHAR NO-UNDO.
DEFINE VARIABLE myObj AS JsonObject NO-UNDO.
DEFINE VARIABLE myOrderObj AS JsonObject NO-UNDO.
DEFINE VARIABLE myLongchar as LONGCHAR NO-UNDO.

/*
 .
 . Set CustInfo to the JsonObjet shown above.
 .
 */

myObj = CAST(myParser:Parse(CustInfo), JsonObject).
myOrderObj = myObj:GetJsonObject("CustOrder"):GetJsonObject("Order").
myOrderObject:Write(myLongchar, TRUE).

The following is the resulting myLongchar value:

{"OrderNum": 82, "OrderDate": "2010-09-20"}