JDP Science Tools

cancel
Showing results for 
Search instead for 
Did you mean: 

JSONtext: JSON Schema?

James,

 

I didn't find out "Generate JSON Schema from LV Datatype" at JSONtext library as below. Can you please share where we are able to download it?

 

SkkjhlSkk9147_0-1719869241903.png

 

0 Kudos
Message 21 of 31
(1,467 Views)

I think there is no generate Schema from Labview date type functionality yet in JSONtext.

 

I'm currently working on one and will try  release a package soon. 

Message 22 of 31
(1,462 Views)

@JoGra wrote:

I think there is no generate Schema from Labview date type functionality yet in JSONtext.

 

I'm currently working on one and will try  release a package soon. 


I've needed this too and have made some progress. Would be happy to share/collaborate.

0 Kudos
Message 23 of 31
(1,406 Views)

I've created a working repo here: https://github.com/JKISoftware/generate-json-schema-labview

 

Note that the code is quite simple (not much more complicated than what you're looking at below)

Jim_Kring_0-1723147458328.png

 

Message 24 of 31
(1,401 Views)

Hi Jim,

Is the repo public?
I can't find it on GitHub..

Cheers


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 25 of 31
(1,388 Views)

Hi Jim, 

I have made some more progress and could make the repo now public: novatron-fusion/LabVIEW-JSON-Schema-Generator (github.com)

Please have a look! I would be glad for any feedback.

Message 26 of 31
(1,351 Views)

I've also now added a simple Schema Generator to the package:

drjdpowell_0-1733734230266.png

 

Message 27 of 31
(1,141 Views)

Hi guys,

 

I am not very savvy with JSON formats, and I would like to use the 'Validate Against JSON Schema.vi' to show user where a mistake is:

JohnatanBravo_0-1770899858306.png

 


How would I infer the JSON Schema from an already existing JSON file?
I am confused as to how to format the JSON Schema input of the above VI.

Would anyone be able to help me out, please?

Below is an example JSON file content:

Spoiler
{
   "Recipe":{
      "UART_Ports":[
         {
            "Device_Name":"UART1",
            "Comm_Name":"UART1",
            "Serial Settings":{
               "timeout(ms)":1000,
               "baud rate":19200,
               "data bits":8,
               "parity":0,
               "stop bits(10;15;20)":10,
               "flow control":0
            }
         },
         {
            "Device_Name":"UART2",
            "Comm_Name":"UART2",
            "Serial Settings":{
               "timeout(ms)":1000,
               "baud rate":19200,
               "data bits":8,
               "parity":0,
               "stop bits(10;15;20)":10,
               "flow control":0
            }
         }
      ],
      "DAQ_config":{
         "Digital_Inputs":[
            {
               "Alias":"Bon_Down",
               "Channel_Address":"cDAQ1Mod1_NI9375/port0/line11"
            },
            {
               "Alias":"Air_Pressure_OK",
               "Channel_Address":"cDAQ1Mod1_NI9375/port0/line14"
            }
         ],
         "Digital_Outputs":[
            {
               "Alias":"Close_Canopy",
               "Channel_Address":"cDAQ1Mod1_NI9375/port1/line0"
            },
            {
               "Alias":"BON_Up",
               "Channel_Address":"cDAQ1Mod1_NI9375/port1/line3"
            }
         ],
         "Analog_Inputs":[
            
         ],
         "Analog_Outputs":[
            
         ]
      },
      "Test steps":[
         {
            "retests":0,
            "continue on failure":false,
            "Log results":true,
            "Test_name":"step1",
            "Enable":true
         },
         {
            "retests":0,
            "continue on failure":false,
            "Log results":true,
            "Test_name":"step2",
            "Enable":true
         }
      ],
      "UUT_Spec_Limits":[
         
      ],
      "General Info":{
         "Model Name":"modelName",
         "Event Logger":false
      },
      "DataBase_Config":{
         "Enable DB":true,
         "Results Table Name":"tbl_name"
      },
      "Execution_Config":{
         "Stop On First Fail":true,
         "Nr of Repeat":0,
         "Repeat Sequence":false,
         "Sleep before repeat":0
      },
      "Process_Conditions":{
         "Start_Conditions":[
            {
               "Channel Alias":"Air_Pressure_OK",
               "Expected State":true
            },
            {
               "Channel Alias":"E_Stop_OK",
               "Expected State":true
            }
         ],
         "Test_Running_Conditions":[
            
         ],
         "Stop_Conditions":[
            
         ],
         "Abort_Conditions":[
            {
               "Channel Alias":"STOP_Signal",
               "Expected State":false
            }
         ]
      }
   },
   "Project_Specific":{
      "Product Config":{
         "Product SKU":"",
         "...Technician Entry...":""
      },
      "Station Config":{
         "Station Option (eg. DB)":"",
         "Station Option (eg. ID)":"",
         "...Engineer Entry...":"",
         "BarcodeLength":23,
         "BarcodeDashNumberPresent":false,
         "UserIdMajorMinorBuild":"0.0.14"
      },
      "Move_To_TFW_PC":{
         "TCP/IP Present":false,
         "Use_Limits_Database":true
      },
      "CW Mask Limits":[
         [
            0,
            -78
         ],
         [
            460,
            -78
         ]
      ],
      "CM Mask Limits":[
         [
            0,
            -77
         ],
         [
            460,
            -77
         ]
      ]
   }
}


Thanks

0 Kudos
Message 28 of 31
(38 Views)

There is a generate schema function in the library that should make a basic schema from your JSON.

0 Kudos
Message 29 of 31
(27 Views)

Thanks, wasn't aware of that function, I'll give it a go.

0 Kudos
Message 30 of 31
(19 Views)