Table of Contents

Search

  1. Preface
  2. Overview, Downloading, and Installing
  3. Administration API
  4. Identity Service API
  5. Screenflow Programming and SDK
  6. ActiveVOS WSHT API
  7. Embedding Request Forms in Standalone Web Pages
  8. XML-JSON for Process Central

APIs, SDKs, and Services

APIs, SDKs, and Services

Using AE_JSON_NODE_UTIL JavaScript library

Using AE_JSON_NODE_UTIL JavaScript library

The
AE_JSON_NODE_UTIL
JavaScript object provided by the
ae-avc-util.js
script file included with this SDK has helper functions that you can use when working with JSON representation of XML data.
Function
Description
AE_JSON_NODE_UTIL.getElements( aJsonObject)
Returns JSON objects in an array. Use this when the JSON object represents a repeating element.
var phones = AE_JSON_NODE_UTIL.getElements( doc.person.contactInfo.phone); // phones is an array.
AE_JSON_NODE_UTIL.getText( aJsonObject, aDefaultText)
Returns the text value (the value of
$t
property) given the JSON object. If the text node does not exist, the default string value is returned.
// get first number or return "Not Available" if number does not exist. var phones = AE_JSON_NODE_UTIL.getElements(doc.person.contactInfo.phone); // phone_number is 203-555-1212. var phone_number = AE_JSON_NODE_UTIL.getText(phones[0], "Not Available");
AE_JSON_NODE_UTIL.isXsiNil( aJsonObject)
Returns true if the
aJsonObject
element exists and it is XSI nulled.
AE_JSON_NODE_UTIL.getAttribute( aJsonObj, aAttributeName, aDefault)
Returns attribute value given its name. If the attribute does not exist, the default value is returned. Normally you do not have to use this function as you can directly access JSON properties (attributes). This method is useful if your XML has a case where an element child and attribute have the same name (see restrictions above).
// get list of phones var phones = AE_JSON_NODE_UTIL.getElements(doc.person.contactInfo.phone); // get phone type (voice, fax etc.) var phone_type = AE_JSON_NODE_UTIL.getAttribute(phones[0], "type", "Not Available"); // phone_type is 'voice'.

0 COMMENTS

We’d like to hear from you!