JSON-Viewer icon indicating copy to clipboard operation
JSON-Viewer copied to clipboard

When the json has some type error, the plugin cann't work.

Open alongL opened this issue 2 years ago • 2 comments

my json is like this. there are some error at last. So the plugin cannot work. Cant it works for the content previous errors? May be it 's a little hard. I copy it into vscode to show. It's ok.

{"deviceInstances":[{"id":"traffic-light-instance-01","name":"traffic-light-instance-01","model":"traffic-light","twins":[{"propertyName":"red","desired":{"value":"ON","metadata":{"type":"string"}},"reported":{"value":"ON","metadata":{"timestamp":"1655777520444","type":"string"}}},{"propertyName":"yellow","desired":{"value":"OFF","metadata":{"type":"string"}},"reported":{"value":"OFF","metadata":{"timestamp":"1655777520444","type":"string"}}},{"propertyName":"green","desired":{"value":"ON","metadata":{"type":"string"}},"reported":{"value":"ON","metadata":{"timestamp":"1655777520444","type":"string"}}}]},{"id":"lamp-opcua","name":"lamp-opcua","protocol":"opcua-lamp-opcua","model":"opcua-model","twins":[{"propertyName":"switcher","desired":{"value":"false","metadata":{"timestamp":"1550049403598","type":"boolean"}},"reported":{"value":"true","metadata":{"timestamp":"1655779193063","type":"boolean"}}},{"propertyName":"temperature","desired":{"value":""},"reported":{"value":"17","metadata":{"timestamp":"1655779193079","type":"string"}}}],"propertyVisitors":[{"name":"temperature","propertyName":"temperature","modelName":"opcua-model","protocol":"opcua","visitorConfig":{"nodeID":"ns=3;i=2002"}},{"name":"switcher","propertyName":"switcher","modelName":"opcua-model","protocol":"opcua","visitorConfig":{"nodeID":"ns=3;i=2003"}}]}],"deviceModels":[{"name":"traffic-light","properties":[{"name":"red","dataType":"string","description":"Indicates
    whether the led light is ON/OFF","accessMode":"ReadWrite","defaultValue":"OFF"},{"name":"yellow","dataType":"string","description":"Indicates
    whether the yellow light is ON/OFF","accessMode":"ReadWrite","defaultValue":"OFF"},{"name":"green","dataType":"string","description":"Indicates
    whether the green light is ON/OFF","accessMode":"ReadWrite","defaultValue":"OFF"},{"name":"red-pin-number","dataType":"int","description":"Indicates
    red led pin munber","accessMode":"ReadOnly","defaultValue":25,"minimum":0,"maximum":0},{"name":"green-pin-number","dataType":"int","description":"Indicates
    green led pin munber","accessMode":"ReadOnly","defaultValue":23,"minimum":0,"maximum":0},{"name":"yellow-pin-number","dataType":"int","description":"Indicates
    rellow led pin munber","accessMode":"ReadOnly","defaultValue":24,"minimum":0,"maximum":0}]},{"name":"opcua-model","properties":[{"name":"temperature","dataType":"int","description":"temperature
    in degree celsius","accessMode":"ReadOnly","defaultValue":1,"minimum":0,"maximum":0},{"name":"switcher","dataType":"boolean","description":"turn
    on or turn off","accessMode":"ReadWrite","defaultValue":false}]}],"protocols":[{"protocolConfig":null,"protocolCommonConfig":null},{"name":"opcua-lamp-opcua","protocol":"opcua","protocolConfig":{"url":"opc.tcp://192.168.137.100:4840/","userName":"testuser","password":"/ca/pass","securityMode":"None","certificate":"/ca/clientcert.pem","privateKey":"/ca/clientkey.pem"},"protocolCommonConfig":{"customizedValues":{"remoteCertificate":"/ca/servercert.pem"}}}]}

alongL avatar Jun 28 '22 02:06 alongL

Personally, I too would like the plugin to be more forgiving of JSON errors, but I certainly understand if that's too much work.

Gitoffthelawn avatar Jun 28 '22 05:06 Gitoffthelawn

@alongL , I guess it work. Hope, this is what your ask.

I copied the text the text and open json viewer window. I see below -

image

Please note: that formatting of this is not possible as the json itself has error.

SinghRajenM avatar Sep 24 '22 12:09 SinghRajenM

Feel free to reopen or open a new bug if anything needs attention.

SinghRajenM avatar Jan 28 '23 11:01 SinghRajenM