Simple JSON Parser for Visual Basic in Class

 

Example

 


        Dim JSON As New json


        JSON.Text = System.IO.File.ReadAllText("C:\installer.json").Replace(vbCr, "").Replace(vbLf, "")

        Dim p() As String = New String() {"0", "devices", "0"}

        Dim v As json_value = JSON.Value(p, True)

        Console.WriteLine(JSON.Count.ToString

 

 

json_type in json_value

     null = 0

     bool, numeric, text  in json_value.VALUE

     array  in json_value.VALUES

 

' Read all values

Dim v() as json_value = JSON.Value()

 

' Read specific value

' Path should be list of ID in level, array ID is 0 ~ nn

Dim v1 as json_value = JSON.Value(path() as string)

 

' Read specific value, ignore case of ID while compare

Dim v1 as json_value = JSON.Value(path() as string, True)

 

if can not find a data using IDs, it will return nothing.

if found a data, check json_value.type, and handle the data

This is a good article to read who want to make a remote access

 

https://thecomputerperson.wordpress.com/2016/08/28/reverse-engineering-the-enphase-installer-toolkit/

 

Thank to the app developer

 

Finally, I have made a simple software using Visual Basic (2015) to monitor Envoy Remotly.

I have attached a source code in this article.

 

Prepare Remote Access Method

 

(1) Router Port Forward If needed

   * I am using 80 port for this web server, so, I have forward 180 to 80 to Envoy which has connected via WiFi

   * It makes me to connect on Envoy Web interface remotely

 

(2) I am getting inverter informaiton

 

http://envoy:xxxxxx@forby.com:180/api/v1/production/inverters

 

   * xxxxxx = last six digit of sserial number of your envoy

   * forby.com = it is my home router domain, you can use IP address or your own domain

 

(3) I am getting meter information

 

http://forby.com:180/production.json

 

   * forby.com = it is my home router domain, you can use IP address or your own domain


This software is not completed yet, I just upload back-born for testing, now

 

ToDo :

          * configuration window

          * data logging into DB

          * create static web page for my web server, and upload

         

 

envoy.jpg