CADViewer Technical Documentation, Installation Guide and Reference Samples Library

JSON Structure & JSON Commands

Below are the API methods for operating on the Space Objects JSON Stucture. For manipulation of data fields inside Space Objects, see:

NOTE: When loading or saving multiple Space Objects, they will sequentially stored in a JSON element named ‘SpaceObjects’. The links below will open the command documentation in the CADViewer JavaScript API.



The SpaceObject JSON structure

The API method cvjs_createNewJSonSpaceObject() creates a default Space Object with the following structure. This is the template used for all Space Object interaction.


var jsonStructure =  	{	
  "path": path,
  "tags": tags, 
  "node": node, 
  "area": area, 
  "outerhtml": outerHTML, 
  "occupancy": occupancy, 
  "name": name, 
  "type": type, 
  "id": id, 
  "defaultcolor": defaultcolor, 
  "highlightcolor": highlightcolor, 
  "selectcolor": selectcolor, 
  "layer": layer, 
  "group": group, 
  "linked": linked, 
  "attributes": attributes, 
  "attributeStatus": attributeStatus, 
  "displaySpaceObject": displaySpaceObject,
  "translate_x": translate_x, 
  "translate_y": translate_y, 
  "scale_x": scale_x ,
  "scale_y": scale_y ,
  "rotate": rotate, 
  "transform": transform, 
  "svgx": svgx, 
  "svgy": svgx, 
  "dwgx": dwgx, 
  "dwgy": dwgy , 
  "customContent" : mycustomcontent,
  "pageNumber" : "",
  "pageName" : "",
  "block" : "",
  "blockAttributeId" : "",
  "blockAttributeCount" : ""
  "clickhandler" : "enable",
  "parent" : "none",
}

The application programmer can grab these JSON objects and manipulate them using the API methods listed at the top of this section.

User controlled SpaceObject Fields:

Below are listed the SpaceObject field that users can modify in their code. NOTE: , the field “id” most differ and the field “name” should differ between SpaceObjects.


  "tags": tags, 
  "node": node, 
  "occupancy": occupancy, 
  "name": name, 
  "type": type, 
  "id": id, 
  "defaultcolor": defaultcolor, 
  "highlightcolor": highlightcolor, 
  "selectcolor": selectcolor, 
  "layer": layer, 
  "group": group, 
  "attributes": attributes, 
  "attributeStatus": attributeStatus, 
  "displaySpaceObject": displaySpaceObject,
  "customContent" : mycustomcontent,

NOTE: The field: “customContent” allows the application programmer to add their own content to the JSON Space object.


Reserved Space Object Fields:

Below are listed the reserved fields that CADViewer uses internally to position and manipulate the SpaceObjects.


  "path": path,
  "outerhtml": outerHTML, 
  "linked": linked, 
  "attributeStatus": attributeStatus, 
  "displaySpaceObject": displaySpaceObject,
  "translate_x": translate_x, 
  "translate_y": translate_y, 
  "scale_x": scale_x ,
  "scale_y": scale_y ,
  "rotate": rotate, 
  "transform": transform, 
  "svgx": svgx, 
  "svgy": svgx, 
  "dwgx": dwgx, 
  "dwgy": dwgy , 
  "pageNumber" : "",
  "pageName" : "",
  "block" : "",
  "blockAttributeId" : "",
  "blockAttributeCount" : ""
  "clickhandler" : "enable",
  "parent" : "none",


Last updated on 8 Dec 2022
Published on 13 Mar 2020