Results 1 to 7 of 7

Thread: Newtonsoft help - declaring a JObject

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2006
    Location
    MI
    Posts
    2,012

    Newtonsoft help - declaring a JObject

    I want to use Newtonsoft JSON.Net to save & load program settings in a file.

    I want the structure of the file to be like:

    Code:
    Settings
        Setting1:value
        Setting2:value
        Setting3:value
    I can create a JObject as follows, but it doesn't have the top level node:

    Code:
        Dim settings As JObject = New JObject From {
        {"Setting1", 5},
        {"Setting2", 10},
        {"Setting3", 15}
    }
    I can't for the life of me figure out how to add the top level "Settings" node in the JObject declaration.

    In tried:

    Code:
        Dim setting As JObject = New JObject From {
        {"Settings",
        {"Setting1", 5},
        {"Setting2", 10},
        {"Setting3", 15}
    }}
    Basically I want the various settings to be under a Settings node. I could not find any examples in the documentation that shows how to do this. Hoping someone can help me out. Thanks...
    Last edited by nbrege; Jan 25th, 2024 at 03:09 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width