JSON Formats: Difference between revisions

From Software Product Documentation
Jump to navigation Jump to search
No edit summary
 
(43 intermediate revisions by the same user not shown)
Line 1: Line 1:
Saving data in JSON format is useful for web-based graphing and presentations.


The first option is limited to just saving the data used in a report graph. This requires that you first create your report and graphs ([[Visual3D_Reports|Documented here]]).  Select the report you want to export, and select the JSON output option from the pop-up dialog.
{| align="right"
| __TOC__
|}
 
Saving data in JSON (Javascript Object Notation) format is useful for web-based graphing and presentations.  JSON is a human-readable format and is typically used to pass data from a web server to a javascript program in a web browser.<br>
 
The JSON output file from Visual3D can then be parsed and used by a javascript, ES6, or PHP program for use on the web.
 
 
''This option is only available in Visual3D version 2020.06.01 and later.''<br>
There is an example javascript parsing program available for web graphing of Visual3D data.  However, because it requires specialized coding knowledge it is only available by request from C-Motion support.
 
 
=Report Graph Export=
 
'''The first option is used to export the data used in a report graph.''' This requires that you first create your report and graphs ([[Visual3D_Reports|Documented here]]).  Select the report you want to export, and select the JSON output option from the pop-up dialog.




[[file:exportreport.png]]
[[file:exportreport.png]]


If the mean and standard deviation were displayed in the graph, they will be in the exported data too. The JSON format for mean and std dev are similare to the normal ASCII output in that the 2 X-components are listed first, and then the 2 Y components. The graphed data is listed in X and Y sections together.
If the mean and standard deviation were displayed in the graph, they will be in the exported data too. The JSON format for mean and std dev are similar to the normal ASCII output in that the 2 X-components are listed first, and then the 2 Y components. The graphed data is listed in X and Y sections together.


The JSON output is a single array for the graph, with sub-arrays for signal information and for data.
The JSON output is a single array for the graph, with sub-arrays for signal information and for data.


{"graph_title": [
    {"report" : [{"signal_info" : {"filename" : "C:\Visual3D\Data\Full Body Gait\FullBodyWalking.c3d", "folder" : "Original", "type" : "FRAME_NUMBERS", "frames" : 112, "X_axis" : "Time"}},
  {"TIME" : [ 0.933333, 0.941667,  ...  1.125000]}
    ]},


    {"report" : [{"signal_info" : {"filename" : "C:\Visual3D\Data\Full Body Gait\FullBodyWalking.c3d", "folder" : "Original", "type" : "LINK_MODEL_BASED", "frames" : 112, "Y_axis" : "Degrees"}},  
:{"title": "graph_title_here", "graphdata" : [
  {"RPV_ANGLE" : [ "no_data", "no_data", -1.811149, -1.873471, ... ]}
:::      {"filename": "C:/Visual3D/Data/Full Body Gait/FullBodyWalking.c3d",
    ]}
::::      "type": "FRAME_NUMBERS",
]}
::::      "folder": "Original",
::::      "name" : "TIME",
::::      "X_axis_label": "Time",
::::      "frames": 112,
::::      "data": [0.933333, 0.941667, ...1.125000]
:::      },


The more general option it to use the [[Export_Data_To_ASCII||Export_Data_To_ASCII]] pipeline command.
:::      {"filename": "C:/Visual3D/Data/Full Body Gait/FullBodyWalking.c3d",
Simply check the JSON format checkbox in the dialog, or un-comment and change the USE JSON FORMAT = TRUE; from the textual interface.
::::        "type": "LINK_MODEL_BASED",
::::        "folder": "Original",
::::        "name" : "RPV_ANGLE",
::::        "Y_axis_label": "Degrees"
::::        "frames": 112,
::::        "data": `["no_data", "no_data", -1.811149, -1.873471, ...]
:::      }
:    ]}


The resulting JSON format for that (assuming only the Y and Z components were selected to export below) is:
=Export Data As ASCII Command=


{"Visual3D" : [
'''The more general option''' is to use the [[Export_Data_To_ASCII_File|Export_Data_To_ASCII_File]] '''pipeline command'''.
{"filename" : "Mean"},
Simply check the JSON format checkbox in the dialog, or un-comment and change the parameter USE JSON FORMAT = TRUE; from the textual interface.
{"filedata" : [
{"type" : "LINK_MODEL_BASED"},
{"folder": "ORIGINAL"},
{"name" : "LFT_ANGLE"},
{"frames" : "101"},


{"Y" : [-7.00954, ...,"nodata"
The resulting JSON output format for that is:
]},


{"Z" : [16.03672,
:{"Visual3D" : [
14.84915,13.68475, ...  
:: {"filename" : "Mean"
]}
:::  "type" : "LINK_MODEL_BASED", 
]}
:::  "folder": "ORIGINAL", 
]}
:::  "name" : "LFT_ANGLE", 
:::  "frames" : "101",
:::  "signal" : [       
:::: {"component" : "X", "data" : [0, ...,null ]},
:
:::: {"component" : "Y", "data" : [-7.00954, ...,null ]},
:
:::: {"component" : "Z", "data" : [16.03672, 13.68475, ... ]}
:: ]}
:]}

Latest revision as of 14:21, 3 April 2021

Saving data in JSON (Javascript Object Notation) format is useful for web-based graphing and presentations. JSON is a human-readable format and is typically used to pass data from a web server to a javascript program in a web browser.

The JSON output file from Visual3D can then be parsed and used by a javascript, ES6, or PHP program for use on the web.


This option is only available in Visual3D version 2020.06.01 and later.
There is an example javascript parsing program available for web graphing of Visual3D data. However, because it requires specialized coding knowledge it is only available by request from C-Motion support.


Report Graph Export

The first option is used to export the data used in a report graph. This requires that you first create your report and graphs (Documented here). Select the report you want to export, and select the JSON output option from the pop-up dialog.


If the mean and standard deviation were displayed in the graph, they will be in the exported data too. The JSON format for mean and std dev are similar to the normal ASCII output in that the 2 X-components are listed first, and then the 2 Y components. The graphed data is listed in X and Y sections together.

The JSON output is a single array for the graph, with sub-arrays for signal information and for data.


{"title": "graph_title_here", "graphdata" : [
{"filename": "C:/Visual3D/Data/Full Body Gait/FullBodyWalking.c3d",
"type": "FRAME_NUMBERS",
"folder": "Original",
"name" : "TIME",
"X_axis_label": "Time",
"frames": 112,
"data": [0.933333, 0.941667, ...1.125000]
},
{"filename": "C:/Visual3D/Data/Full Body Gait/FullBodyWalking.c3d",
"type": "LINK_MODEL_BASED",
"folder": "Original",
"name" : "RPV_ANGLE",
"Y_axis_label": "Degrees"
"frames": 112,
"data": `["no_data", "no_data", -1.811149, -1.873471, ...]
}
]}

Export Data As ASCII Command

The more general option is to use the Export_Data_To_ASCII_File pipeline command. Simply check the JSON format checkbox in the dialog, or un-comment and change the parameter USE JSON FORMAT = TRUE; from the textual interface.

The resulting JSON output format for that is:

{"Visual3D" : [
{"filename" : "Mean"
"type" : "LINK_MODEL_BASED",
"folder": "ORIGINAL",
"name" : "LFT_ANGLE",
"frames" : "101",
"signal" : [
{"component" : "X", "data" : [0, ...,null ]},
{"component" : "Y", "data" : [-7.00954, ...,null ]},
{"component" : "Z", "data" : [16.03672, 13.68475, ... ]}
]}
]}
Retrieved from ""