What is the best method for converting a JObject to an array in VB.net?

How can I convert a JObject into a specific property list?

Below is the JSON data I have:

{

"response":{
    "result":1,
    "resultcount":1,
    "collectiondetails":[
        {
            "publishedfileid":"1717998413",
            "result":1,
            "children":[
                {
                    "publishedfileid":"109643223",
                    "sortorder":1,
                    "filetype":0
                },
                {
                    "publishedfileid":"1498270631",
                    "sortorder":2,
                    "filetype":0
                },
                {
                    "publishedfileid":"162218499",
                    "sortorder":3,
                    "filetype":0
                },
                {
                    "publishedfileid":"1419266438",
                    "sortorder":4,
                    "filetype":0
                },
                {
                    "publishedfileid":"245482078",
                    "sortorder":5,
                    "filetype":0
                }
            ]
        }
    ]
}
}

I am looking to extract and create a list of values from the "publishedfileid" property.

I started off with this code snippet:

Dim rawJson = Newtonsoft.Json.Linq.JObject.Parse(jsonString)
, but unsure about the next steps.

Thank you in advance for your help. Best regards,

Answer №1

Issue resolved with the help of @Jimi

Updated my previous code to

Dim rawJson = JsonConvert.DeserializeObject(Of Rootobject)(jsonString)
and iterated through
rawJson.response.collectiondetails(0).children

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The Struts2 JSON response received through the $.getJSON method is showing an unexpected undefined result

Attempting to retrieve a String value from an action class using the $.getJSON method, but receiving an output of undefined. Below are the code snippets that have been tested: Script: $(function() { $("#newPostionFormID").submit( ...

Excessive string length within a JSON array results in a 400 Bad Request error on a .NET Core Web API

Within my JavaScript application, I am utilizing the fetch API to send an array that contains a lengthy string to a .NET Core Web API. The structure of this data looks like: "FirstName LastName (Country) TEXT INFORMATION: ^MOM?ROVAL LETTER REQUI ...

Rails: Ensure that JSON form fields remain populated in case the form encounters a validation error

I am using a rails simple form to create a product with three fields inside in order to associate it with appropriate categories: <div class="form-group"> <%= f.input :child_category_id, :collection => @categories.order(:name), :l ...

Linking a JSON or JSON array to a Grails object

When I receive a response in the form of a JSON array, it can either be an array of values like ['1', '1', '2'] or an array of objects like [{'name': 'blabla', age: '30'}, {'name': ...

Creating dynamic web content using PHP and JavaScript

I stumbled upon a tutorial on the PHP.net website within the "PHP and HTML" manual which includes an example titled Generating JavaScript with PHP. Currently, I am experimenting with a basic demo of this concept on my own to grasp the process before attem ...

Filtering JSON data by date range in React JS

I have a dataset with JSON data containing ISO dates, and my goal is to filter out entries based on the "date_created" field falling within a specific date range. The time component should be ignored in this comparison, and the original JSON data should re ...

I'm puzzled as to why my HTTP request in Node.js is returning an empty body

Currently, I am facing an issue where I am sending a HTTP request to a server and expecting a response that contains all the necessary information. However, when attempting to parse the body using .parseJSON(), an exception is thrown indicating that the ...

Insert a fresh key-value pair into a JSON document using Powershell

Recently, I've been working with a JSON file that looks like this: { "buildDate": "2017-08-16", "version": "v1.2.0" } I've been wondering about how to add new key-value pairs to an existing JSON file. For instance, starting with the J ...

What is preventing me from retrieving the JSon data?

I've been attempting to retrieve the count of a variable through ajax, but I keep receiving a "fail" message every time Here is the php file that runs perfectly when tested: <?php $conn= mysqli_connect("localhost","root","") or die ("could not ...

Refreshing of JSON data does not occur

I'm currently working on developing an Android app that involves JSON Parsing. I have a php script hosted on my server that fetches data from a MySQL database and encodes it to JSON. The app communicates with the server to retrieve this data and popul ...

What is the process of dynamically creating a Javascript object?

I have been experimenting with creating the following custom array: var deal_info = { "1": { "deal": { "deal_id": "1", "qty": "1", "option_price_sale": "7900", "price_ship": "2500", " ...

Having trouble making modifications to the pom.xml file in Eclipse JEE?

Is there a way to modify the pom.xml file without it reverting back to its original state? I'm trying to remove comments so that dependencies of JSON response can be utilized. Any suggestions on how to make permanent changes? Your assistance is gre ...

Having issues retrieving data from an ArcGis Database?

Currently, I am attempting to extract age information from a particular map. To find the relevant data, please navigate to the "Cases By County" section of this map and click on the right arrow once: View Map Here. Following advice from a helpful source o ...

PHP does not detect the Ajax object that has been sent to it

Here's the data I am trying to send: In this blockquote: switch=rssAdd&data=[object Object],[object Object]... etc. This data is generated by the following code snippet: The Javascript function shown above parses XML elements and formats them ...

How to extract a list from a dictionary using Python and a JSON file

I'm brand new to Python and could really use some guidance. My goal is to utilize Python to extract the values of a list within a dictionary from my JSON file. After successfully reading the JSON data into my program, I have: request body = { " ...

Contrast the dissimilarities between JSON and alternative errors

encoder := json.NewEncoder(writer) error := encoder.Encode(struct { RequestMethod string `json:"request_method"` QueryResults []interface{} `json:"query_results"` TimeInCache int `json:"time_in_cache"` }{RequestMethod: pro ...

Extract an array segment from a JSON document and convert it into a list

In my JSON file, there is a valid list/Array of databases structured as follows: { "Logging": { "IncludeScopes": false, "LogLevel": { "Default": "Debug" } }, "settings": { ...

POST requests in Express node sometimes have an empty req.body

Server Code: const express = require('express') const app = express() app.use(express.static('public')) app.use(express.json({limit :'100mb'})); app.post('/post', (req, res) => { console.log('post called ...

Create an API using asp.net MVC technology within a web application framework

I have a MVC 3 Web Application with approximately 50 Views. I am curious if it is feasible to incorporate an API alongside these Views without any complications. In my ideal scenario, the server would be operational and every request would be directed to ...

Utilize the power of Request.JSON to send an HTML array as a post

I have a piece of HTML code that includes form elements: First name: <input type='text' name='first_name' value='' /><br/> Last name: <input type='text' name='last_name' value='' / ...