ftos.utils.json.getObjectKeys
Retrieves the property names (keys) of a JavaScript or .NET object instance.
HINT
When running in Jint,
When running in Jint,
Object.keys() returns an empty array for .NET objects. This method provides an alternative that can enumerate .NET members.Syntax
Copy
ftos.utils.json.getObjectKeys(target: any): string[]
| Parameter | Type | Description |
|---|---|---|
target
|
any | The object whose property names are to be retrieved. May be a native JavaScript object, a JSON object, or a .NET object exposed in Jint. |
Return Value
Returns an array of strings representing the property names of the specified object.
Example
This example:
- Extracts the key names from the Customers entity's business statuses mapping using the ftos.businessStatusWorkflow.getStatuses method.
- Stores the list of IDs in a variable called statuses.
Copy
var statuses = ftos.businessStatusWorkflow.getStatuses("Customers");
var statusIds = ftos.utils.json.getObjectKeys(statuses);
// Example output: ["Active", "Inactive", "Pending"]