Loads data from a JSON stream into a component.


Return Values

Values returned in $status




An error occurred. $procerror contains the exact error.


JSON stream successfully loaded


JSON stream loaded, but could not find all the field and entity names specified in the default and local mappings. For each field not found, $status is incremented by 1. More information is available in the message frame if the assignment setting $TEST_MODE_COMPONENTS is set.


Values of $procerror commonly returned by webload


Error constant


-257 <UWEBERR_ILLEGAL_ACT> One or more fields cannot be accessed. This occurs when field names mentioned in the HTML page are not available in the current component in Uniface. For example, if the Detail trigger of a command button does not contain a public web declaration.
-259 <UWEBERR_HASH> Mismatch between the security hash of a field and the field value. This can occur when the value of a NED field has been modified by the browser or other web user agent.
-261 <UWEBERR_DATA> An error occurred while loading data. Incorrect data values or data formats were encountered during server-side validation of a Date, Time, or DateTime field.


Only for use in dynamic server pages.


The webload statement transfers data from a JSON stream into a component. The data is loaded from the $webinfo("data") channel directly into the component's data structure.

webload checks for JSON parsing errors, mismatched hash security values for NED fields, and incorrect field values and data formats in Date, Time, or DateTime fields. However, it does not interpret or initiate other data validation, so the data loaded by webload can include duplicates of occurrences already within the component, as well as occurrences marked for deletion.

All occurrences loaded from a data stream (including occurrences marked for deletion) are available in the component structure and accessible in Proc.

You can use the $JSON_INDENT and $JSON_SHOWNAMES assignment settings to make the JSON stream more human-readable for development and debugging purposes.

Reconnect Loaded Data

The webload statement also sets state flags used by reconnect. After every webload statement, you should use a reconnect statement to reconnect the loaded data with the data in the component and the database (if connected). reconnect removes duplicates of occurrences, removes occurrences marked for deletion from the component, and sets the appropriate modification flags. For more information, see Reconnect Process.

Triggers Fired by webload

The webload statement fires the following triggers that can be used to to customize how a JSON stream is loaded into a component:

  • Pre Load Occurrence—fired immediately before an occurrence is loaded from a JSON stream into a component. The new occurrence is not yet available and cannot be accessed. This trigger tunes the execution of webload and websave. You can use this trigger to customize the process of loading a JSON stream into a component.
  • Post Load Occurrence—fired immediately after an occurrence is loaded from a JSON stream into a component and after all On Error triggers caused by validation errors. The new occurrence is available and can be accessed. For example, use this trigger if an occurrence can be discarded, or the value for a derived field can be calculated.

Loading a JSON File

The following example loads a text file containing JSON-formatted data with Japanese characters and data for a non-modeled (dummy) entity.

The component structure contains one database entity JAPAN.JAPAN and a non-modeled entity containing two buttons.

Component structure of DSP

The following JSON data loads the data for the database fields as well as for the dummy fields.

Note:  By default, fields and entities in JSON streams are identified by ID. Fully-qualified names for fields and entities are shown in the nm attribute only when you use the $JSON_SHOWNAMES assignment setting.

   "#2" : { 
    "nm" : "JAPAN.JAPAN",
    "type" : "entity",
    "occs" : [ 
      "id" : "BhJDMTIzNA==",
      "crc" : "00000021",
      "status" : "est",
      "#3" : { 
       "nm" : "ID.JAPAN.JAPAN",
       "value" : "1234"
      "#4" : { 
       "nm" : "BRAND.JAPAN.JAPAN",
       "value" : "SONY"
      "#5" : { 
       "value" : "\u3044\u307E"
   "#6" : { 
    "nm" : "DUM.JAPAN",
    "type" : "entity",
    "occs" : [ 
      "id" : "VE1QOjQ3ODM0M2RhXzFfYmJmNTAw",
      "crc" : "",
      "status" : "new",
      "#7" : { 
       "nm" : "PB1.DUM.JAPAN",
       "value" : "MickeyMouse"
      "#8" : { 
       "nm" : "PB2.DUM.JAPAN",
       "value" : "DonaldDuck"