Imports System.IO
Imports Newtonsoft.Json
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'Create an object to hold the data
Dim data As New Dictionary(Of String, Object)()
data.Add("name", "John Doe")
data.Add("age", 30)
data.Add("isMarried", True)
'Serialize the object to JSON
Dim json As String = JsonConvert.SerializeObject(data, Formatting.Indented)
'Write the JSON to a file
Dim filePath As String = "C:\Temp\data.json"
File.WriteAllText(filePath, json)
'Read the JSON from the file
Dim jsonFromFile As String = File.ReadAllText(filePath)
'Deserialize the JSON to an object
Dim dataFromFile As Dictionary(Of String, Object) = JsonConvert.DeserializeObject(Of Dictionary(Of String, Object))(jsonFromFile)
'Display the data in a messagebox
MessageBox.Show("Name: " & dataFromFile("name").ToString() & vbCrLf & "Age: " & dataFromFile("age").ToString() & vbCrLf & "Married: " & dataFromFile("isMarried").ToString())
End Sub
End Class