Page 1 of 1

JSON Interpreter

PostPosted: Mon Jan 22, 2018 1:30 pm
by ericseipel
Prompted by a post by Daniel Kaminski and subsequent replies by others, I have a question.


Has anyone written a WD JSON interpreter?


Im working on one, mainly for my KiPros, but thankfully they only reply with a specific "yeah i got it" or "yeah, nooooo".

The E2 on the other hand likes to talkback and give info that needs to be parsed a little more delicately. Has anyone done the heavy lifting on this? Other wise i shall push on and post the results.

Re: JSON Interpreter

PostPosted: Mon Jan 22, 2018 9:35 pm
by Dennis Kuypers
Hello,

yes, we have!

Convert a string to json by using ToJson(). You can then use .Set() and .Get().

Example (from the top of my head):
Code: Select all
var json = '{"Response: {"Status": "good"}, "aList": ["first", "second"]}'.ToJson()
var status = json.Get("Reponse.Status")
var secondItem = json.Get("aList.1")


Dennis

Re: JSON Interpreter

PostPosted: Mon Feb 05, 2018 11:10 pm
by chrisr
Eric, I'm definitely interested in communication with E2 via JSON. I just loaded 5.1 toolset simulator on my machines to start testing.

I just started down this path today, I'll share any findings here once I make headway.