Replies: 1 comment 1 reply
-
If the underlying system has a “static” data model, i.e. you have some fixed number of JSON objects and the “shape” of those objects won’t change, you could maybe map those to corresponding custom structured value types. Even that would be tricky in the current version (“1.0”, “2.0”, whatever already has much better support for this). If they aren’t static or known ahead of time you probably can’t do much better than just dumping them into a String value. If you want to be a good OPC UA citizen you could also create a new alias/simple DataType that is a subtype of the built in String DataType and call it “JSON String” or something. This would at least indicate semantically that a client can assume that contents are valid JSON, though a client or the user of the client is still going to need to know that in some capacity. |
Beta Was this translation helpful? Give feedback.
-
I am trying to use JSON values in combination with OPC UA's Variants. Basically, I have an underlying system, for which I want to create an OPC UA server, exposing the data. The data is a JSON model, and while it is easily possible to map the scalar JSON values into Variant counterparts, it gets more tricky with arrays and objects. And I would like to keep it dynamic.
I was wondering if there already is some "standard JSON mapping", and if Milo supports that. A quick check in the issues didn't show anything.
I guess I could write a custom type, which wraps a JSON type into a Union, somehow encoding the object case into an array of key/value entries. Just to keep a static data model, if that is required.
Beta Was this translation helpful? Give feedback.
All reactions