16,012,116 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 9992334 (Top 4 by date)
Member 9992334
17-Jul-19 4:54am
View
Finally I figured out that issues were the classes that was not coorrectly generated due to empty arrays.
Thanks a lot anyway for your help.
Imports System
Imports System.Dynamic
Imports System.Text
Imports System.IO
Imports System.Net.Http
Imports System.Threading.Tasks
Imports RestSharp.Authenticators
Imports Web_request
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Imports RestSharp
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim fileReader As String
fileReader = My.Computer.FileSystem.ReadAllText("C:\Json6.txt")
Resp_API.Text = fileReader
Dim jsonObj = JsonConvert.DeserializeObject(Of Rootobject)(fileReader)
Dim root = jsonObj.units.Item(9)
TextBox1.Text = root.name
End Sub
End Class
Public Class RootObject
Public Property units As List(Of Unit)
End Class
Public Class Unit
Public Property deviceID As Integer
Public Property address As String
Public Property cpu As Integer
Public Property name As String
Public Property type As Integer
Public Property appearance As Integer
Public Property hueID As Integer
Public Property groupID As Integer
Public Property position As Integer
Public Property revision As Integer
Public Property configRevision As Integer
Public Property firmware As Integer
Public Property modes As List(Of Mode)
Public Property smartSwitch As Device
Public Property pushButtonToggleDisabled As Boolean
Public Property presenceSensor As Device
Public Property linkedSensor As Integer
Public Property gain As Integer
Public Property startupMode As Integer
Public Property minOnLevel As Integer
Public Property minLevel As Integer
Public Property maxLevel As Integer
Public Property parameters As List(Of String)
Public Property sequenceCounter As Integer
Public Property behaviour As Integer
Public Property timeout As Integer
Public Property labels As Labels
Public Property details As Details
Public Property actionConfig As Integer
Public Property actions As List(Of String)
End Class
Public Class Device
Public Property type As Integer
Public Property id As Integer
Public Property scenes As List(Of String)
Public Property scenes2 As List(Of String)
Public Property group As Integer
Public Property unit As Integer
Public Property lingerTime As Integer
Public Property fadeTime As Integer
Public Property excludeOFF As Boolean
Public Property index As Integer
End Class
Public Class Labels
End Class
Public Class Details
End Class
Public Class Mode
Public Property name As String
Public Property state As String
Public Property cycle As Boolean
End Class
Member 9992334
16-Jul-19 7:47am
View
Sorry, apologize I attached wrong Json...
This is the small section:
{"units":[{"deviceID":14,"address":"c29419a7442d","cpu":2,"name":"Scale campo","type":526,"appearance":0,"hueID":0,"groupID":0,"position":3,"revision":1,"configRevision":2,"firmware":6656,"modes":[{"name":"unit_mode1","state":"fc03","cycle":true},{"name":"unit_mode2","state":"0000","cycle":false},{"name":"unit_mode3","state":"0000","cycle":false},{"name":"unit_mode4","state":"0000","cycle":false}],"smartSwitch":{"type":0,"id":0,"scenes":[],"scenes2":[],"group":0,"unit":0,"lingerTime":120,"fadeTime":10,"excludeOFF":false,"index":0},"pushButtonToggleDisabled":false,"presenceSensor":{"type":5,"id":0,"scenes":[],"scenes2":[],"group":0,"unit":0,"lingerTime":120,"fadeTime":10,"excludeOFF":false,"index":0},"linkedSensor":0,"gain":100,"startupMode":1,"minOnLevel":0,"minLevel":0,"maxLevel":1,"parameters":[],"sequenceCounter":0,"behaviour":0,"timeout":0,"labels":{},"details":{},"actionConfig":0,"actions":[]},{"deviceID":15,"address":"b12897c544fa","cpu":2,"name":"Scale ingresso","type":526,"appearance":0,"hueID":0,"groupID":0,"position":3,"revision":1,"configRevision":3,"firmware":6656,"modes":[{"name":"unit_mode1","state":"0000","cycle":true},{"name":"unit_mode2","state":"0000","cycle":false},{"name":"unit_mode3","state":"0000","cycle":false},{"name":"unit_mode4","state":"0000","cycle":false}],"smartSwitch":{"type":0,"id":0,"scenes":[],"scenes2":[],"group":0,"unit":0,"lingerTime":120,"fadeTime":10,"excludeOFF":false,"index":0},"pushButtonToggleDisabled":false,"presenceSensor":{"type":5,"id":0,"scenes":[],"scenes2":[],"group":0,"unit":0,"lingerTime":120,"fadeTime":10,"excludeOFF":false,"index":0},"linkedSensor":0,"gain":100,"startupMode":1,"minOnLevel":0,"minLevel":0,"maxLevel":1,"parameters":[],"sequenceCounter":0,"behaviour":0,"timeout":0,"labels":{},"details":{},"actionConfig":0,"actions":[]}]}
Member 9992334
16-Jul-19 7:33am
View
Deleted
You are right . I consumed successful simpler Json... I trYing on Units section of the big Json. Unfortunately I am facing same issues, still too complex to me :( . Any advice ? Thanks regards
{"units":[{"deviceID":14,"address":"c29419a7442d","cpu":2,"name":"Scale campo","type":526,"appearance":0,"hueID":0,"groupID":0,"position":3,"revision":1,"configRevision":2,"firmware":6656,"modes":[{"name":"unit_mode1","state":"fc03","cycle":true},{"name":"unit_mode2","state":"0000","cycle":false},{"name":"unit_mode3","state":"0000","cycle":false},{"name":"unit_mode4","state":"0000","cycle":false}],"smartSwitch":{"type":0,"id":0,"scenes":[],"scenes2":[],"group":0,"unit":0,"lingerTime":120,"fadeTime":10,"excludeOFF":false,"index":0},"pushButtonToggleDisabled":false,"presenceSensor":{"type":5,"id":0,"scenes":[],"scenes2":[],"group":0,"unit":0,"lingerTime":120,"fadeTime":10,"excludeOFF":false,"index":0},"linkedSensor":0,"gain":100,"startupMode":1,"minOnLevel":0,"minLevel":0,"maxLevel":1,"parameters":[],"sequenceCounter":0,"behaviour":0,"timeout":0,"labels":{},"details":{},"actionConfig":0,"actions":[]},{"deviceID":15,"address":"b12897c544fa","cpu":2,"name":"Scale ingresso","type":526,"appearance":0,"hueID":0,"groupID":0,"position":3,"revision":1,"configRevision":3,"firmware":6656,"modes":[{"name":"unit_mode1","state":"0000","cycle":true},{"name":"unit_mode2","state":"0000","cycle":false},{"name":"unit_mode3","state":"0000","cycle":false},{"name":"unit_mode4","state":"0000","cycle":false}],"smartSwitch":{"type":0,"id":0,"scenes":[],"scenes2":[],"group":0,"unit":0,"lingerTime":120,"fadeTime":10,"excludeOFF":false,"index":0},"pushButtonToggleDisabled":false,"presenceSensor":{"type":5,"id":0,"scenes":[],"scenes2":[],"group":0,"unit":0,"lingerTime":120,"fadeTime":10,"excludeOFF":false,"index":0},"linkedSensor":0,"gain":100,"startupMode":1,"minOnLevel":0,"minLevel":0,"maxLevel":1,"parameters":[],"sequenceCounter":0,"behaviour":0,"timeout":0,"labels":{},"details":{},"actionConfig":0,"actions":[]},{"deviceID":1,"address":"fba797e560d3","cpu":2,"name":"Porta garage","type":526,"appearance":0,"hueID":0,"groupID":0,"position":4,"revision":1,"configRevision":3,"firmware":6656,"modes":[{"name":"unit_mode1","state":"0000","cycle":true},{"name":"unit_mode2","state":"0000","cycle":false},{"name":"unit_mode3","state":"0000","cycle":false},{"name":"unit_mode4","state":"0000","cycle":false}],"smartSwitch":{"type":0,"id":0,"scenes":[],"scenes2":[],"group":0,"unit":0,"lingerTime":120,"fadeTime":10,"excludeOFF":false,"index":0},"pushButtonToggleDisabled":false,"presenceSensor":{"type":5,"id":0,"scenes":[],"scenes2":[],"group":0,"unit":0,"lingerTime":120,"fadeTime":10,"excludeOFF":false,"index":0},"linkedSensor":0,"gain":100,"startupMode":1,"minOnLevel":0,"minLevel":0,"maxLevel":1,"parameters":[],"sequenceCounter":0,"behaviour":0,"timeout":0,"labels":{},"details":{},"actionConfig":0,"actions":[]},{"deviceID":9,"address":"31bbe368b8be","cpu":2,"name":"Porticato","type":489,"appearance":0,"hueID":0,"groupID":0,"position":5,"revision":1,"configRevision":7,"firmware":6656,"modes":[{"name":"unit_mode1","state":"00","cycle":true},{"name":"unit_mode2","state":"00","cycle":false},{"name":"unit_mode3","state":"00","cycle":false},{"name":"unit_mode4","state":"00","cycle":false}],"smartSwitch":{"type":2,"id":0,"scenes":[],"scenes2":[],"group":0,"unit":0,"lingerTime":0,"fadeTime":0,"excludeOFF":false,"index":0},"pushButton":{"type":0,"id":0,"scenes":[],"scenes2":[],"group":0,"unit":0,"lingerTime":0,"fadeTime":0,"excludeOFF":false,"index":0},"pushButtonToggleDisabled":false,"presenceSensor":{"type":5,"id":0,"scenes":[],"scenes2":[],"group":0,"unit":0,"lingerTime":120,"fadeTime":10,"excludeOFF":false,"index":0},"linkedSensor":0,"gain":100,"startupMode":1,"minOnLevel":0,"minLevel":0,"maxLevel":1,"parameters":[],"sequenceCounter":0,"behaviour":0,"timeout":0,"labels":{},"details":{},"actionConfig":0,"actions":[]},{"deviceID":7,"address":"d18542f24c05","cpu":2,"name":"Artichoke",
Member 9992334
16-Jul-19 7:25am
View
Deleted
The json is really too big .... I attached the link to the file:https://drive.google.com/open?id=1kXYcoSJE-aAJWX1WR6wjOB4r6AFikhRh.
Thanks anyway